/* === 단과학습 (Subject Study) === */

/* 페이지 범위 선택 (단과학습/수학PDF) */
.ss-page-range { margin-top: 1rem; }
.ss-page-range label { font-size: 0.85rem; color: var(--sand); font-weight: 600; display: block; margin-bottom: 0.3rem; }
.ss-total-pages { color: var(--sand-muted); font-weight: 400; margin-left: 0.3rem; }

/* Reader PDF 범위 모달 */
.pdf-range-modal { max-width: 420px; padding: 1.5rem; }
.pdf-range-modal h3 { margin: 0 0 0.5rem; font-size: 1.1rem; color: var(--gold); }
.pdf-range-modal p { margin: 0 0 1rem; font-size: 0.85rem; color: var(--sand-dark); word-break: break-all; }

/* 시험오답 범위 */
.paper-exam-range { margin-top: 1rem; }
.paper-exam-range label { font-size: 0.85rem; color: var(--sand); font-weight: 600; display: block; margin-bottom: 0.3rem; }

/* 뒤로가기 헤더 */
.ss-back-header {
  margin-bottom: 1rem;
}

.ss-back-btn {
  background: none;
  border: none;
  color: var(--sand-dark);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.3rem 0;
  font-family: var(--font-main);
  transition: color 0.2s;
}

.ss-back-btn:hover {
  color: var(--gold);
}

.ss-back-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 페이지 제목 */
.ss-page-title {
  color: var(--gold);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

/* 제목 안의 아이콘을 텍스트 크기에 맞춤 */
.ss-page-title .icon-lg,
.ss-page-title .icon-inline {
  width: 1.4em;
  height: 1.4em;
  vertical-align: -0.3em;
  object-view-box: inset(30%);
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, black 40%, transparent 65%);
  mask-image: radial-gradient(circle, black 40%, transparent 65%);
}

.ss-page-desc {
  color: var(--sand-dark);
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
}

/* === 과목 선택 그리드 === */
.ss-subject-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 420px;
}

.ss-subject-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem 0.8rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-main);
  color: inherit;
  position: relative;
}

.ss-subject-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.ss-subject-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.ss-subject-card--coming {
  opacity: 0.35;
  cursor: default;
}

.ss-subject-card--coming:hover {
  transform: none;
  background: transparent;
  border-color: transparent;
}

.ss-subject-card.preparing {
  opacity: 0.55;
}

.ss-preparing-tag {
  display: block;
  font-size: 0.65rem;
  color: var(--sand-muted, #999);
  font-weight: 400;
  margin-top: 0.1rem;
}

.ss-subject-icon {
  line-height: 1;
}

/* 과목 아이콘: 크게 표시 + 어두운 배경 페이드 */
.ss-subject-icon .icon-lg {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, black 35%, transparent 65%);
  mask-image: radial-gradient(circle, black 35%, transparent 65%);
}

.ss-subject-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--sand);
}

.ss-coming-badge {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--sand-muted);
}

/* === 학년 선택 그리드 === */
.ss-grade-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  max-width: 360px;
}

.ss-grade-btn {
  padding: 0.9rem;
  background: var(--night-card-70);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--sand);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ss-grade-btn:hover {
  border-color: #5b9bd5;
  background: rgba(91, 155, 213, 0.1);
  color: #5b9bd5;
}

.ss-grade-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* === 모드 선택 카드 === */
.ss-mode-cards {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ss-mode-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  background: var(--night-card-70);
  border: 1px solid var(--border);
  border-left: 3px solid #5b9bd5;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  width: 100%;
  font-family: var(--font-main);
  color: inherit;
}

.ss-mode-card:hover {
  border-color: #5b9bd5;
  background: rgba(91, 155, 213, 0.06);
  transform: translateY(-1px);
}

.ss-mode-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.ss-mode-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.ss-mode-icon img {
  display: block;
}

/* 모드 아이콘 어두운 배경 페이드 */
.ss-mode-icon .icon-mode {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, black 38%, transparent 68%);
  mask-image: radial-gradient(circle, black 38%, transparent 68%);
}

.ss-mode-body {
  flex: 1;
  min-width: 0;
}

.ss-mode-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sand);
  margin-bottom: 0.2rem;
}

.ss-mode-desc {
  font-size: 0.8rem;
  color: var(--sand-dark);
  line-height: 1.5;
}

.ss-mode-arrow {
  font-size: 1.5rem;
  color: var(--sand-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.ss-mode-card:hover .ss-mode-arrow {
  transform: translateX(3px);
  color: #5b9bd5;
}

/* === 학기/시험 선택 === */
.ss-semester-section {
  margin-bottom: 1.2rem;
}

.ss-semester-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sand);
  margin-bottom: 0.5rem;
}

.ss-semester-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  max-width: 360px;
}

.ss-semester-btn {
  padding: 0.9rem 1rem;
  background: var(--night-card-70);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--sand);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ss-semester-btn:hover {
  border-color: #5b9bd5;
  background: rgba(91, 155, 213, 0.1);
  color: #5b9bd5;
}

.ss-semester-btn.selected {
  border-color: #5b9bd5;
  background: rgba(91, 155, 213, 0.18);
  color: #5b9bd5;
  box-shadow: 0 0 0 1px #5b9bd5;
}

.ss-semester-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* === PDF 업로드 === */
.ss-upload-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ss-upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--night-card-70);
  transition: all 0.2s;
  text-align: center;
}

.ss-upload-dropzone.dragover {
  border-color: #5b9bd5;
  background: rgba(91, 155, 213, 0.08);
}

.ss-upload-icon {
  font-size: 2.5rem;
}

.ss-upload-text {
  color: var(--sand-dark);
  font-size: 0.85rem;
}

.ss-file-hidden {
  display: none;
}

.ss-file-info {
  padding: 0.8rem 1rem;
  background: rgba(91, 155, 213, 0.1);
  border: 1px solid rgba(91, 155, 213, 0.3);
  border-radius: var(--radius-sm);
}

.ss-file-name {
  font-size: 0.9rem;
  color: var(--sand);
}

.ss-page-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ss-page-range label {
  font-size: 0.82rem;
  color: var(--sand-dark);
}

.ss-page-range input {
  width: 70px;
  padding: 0.4rem 0.5rem;
  background: rgba(11, 16, 38, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--sand);
  font-size: 0.9rem;
  font-family: var(--font-main);
}

.ss-question-count,
.ss-option-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ss-question-count label,
.ss-option-group label {
  font-size: 0.82rem;
  color: var(--sand-dark);
}

.ss-question-count select,
.ss-option-group select {
  padding: 0.4rem 0.6rem;
  background: rgba(11, 16, 38, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--sand);
  font-size: 0.9rem;
  font-family: var(--font-main);
}

.ss-exam-options,
.ss-listening-options {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.ss-start-btn {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.8rem;
  font-size: 1rem;
}

/* === 로딩 === */
.ss-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 1rem;
  min-height: 300px;
}

.ss-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: #5b9bd5;
  border-radius: 50%;
  animation: ss-spin 0.8s linear infinite;
}

@keyframes ss-spin {
  to { transform: rotate(360deg); }
}

.ss-loading-text {
  font-size: 1rem;
  color: var(--sand);
  font-weight: 600;
}

.ss-loading-sub {
  font-size: 0.82rem;
  color: var(--sand-dark);
  text-align: center;
  line-height: 1.5;
}

/* === PDF 읽기 영역 === */
.ss-reading-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.ss-page-text {
  padding: 1rem;
  background: rgba(11, 16, 38, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ss-page-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #5b9bd5;
  margin-bottom: 0.5rem;
}

.ss-page-content {
  font-size: 0.82rem;
  color: var(--sand);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-main);
}

.ss-reading-actions {
  margin-top: 1rem;
}

/* === 문제 풀기 === */
.ss-quiz-header {
  margin-bottom: 1rem;
}

.ss-quiz-top-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}

.ss-quiz-exit-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--sand-dark);
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font-main);
}

.ss-quiz-exit-btn:hover {
  background: rgba(232, 93, 117, 0.15);
  border-color: var(--rose);
  color: var(--rose-light);
}

.ss-quiz-progress {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.ss-quiz-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--sand);
}

.ss-quiz-type-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  background: rgba(91, 155, 213, 0.15);
  color: #5b9bd5;
  border-radius: 4px;
  font-weight: 600;
}

.ss-timer {
  margin-left: auto;
  font-size: 1rem;
  font-weight: 700;
  color: var(--sage);
  font-family: 'D2Coding', monospace;
}

.ss-timer-warn {
  color: var(--rose);
  animation: ss-blink 0.5s ease-in-out infinite alternate;
}

@keyframes ss-blink {
  to { opacity: 0.4; }
}

.ss-quiz-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.ss-quiz-bar-fill {
  height: 100%;
  background: #5b9bd5;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* 네비게이션 도트 */
.ss-nav-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ss-nav-dot {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: rgba(11, 16, 38, 0.5);
  color: var(--sand-dark);
  font-size: 0.72rem;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ss-nav-dot.active {
  background: #5b9bd5;
  border-color: #5b9bd5;
  color: white;
  font-weight: 700;
}

.ss-nav-dot.answered {
  background: rgba(91, 155, 213, 0.2);
  border-color: rgba(91, 155, 213, 0.4);
  color: #5b9bd5;
}

.ss-nav-dot:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

/* 문제 본문 */
.ss-quiz-body {
  margin-bottom: 1.2rem;
}

.ss-question-text {
  font-size: 0.95rem;
  color: var(--sand);
  line-height: 1.7;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--night-card-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.ss-passage {
  font-size: 0.85rem;
  color: var(--sand-dark);
  line-height: 1.8;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  background: rgba(11, 16, 38, 0.4);
  border-left: 3px solid rgba(91, 155, 213, 0.3);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  white-space: pre-wrap;
}

.ss-underline {
  text-decoration: underline;
  text-decoration-color: #5b9bd5;
  text-underline-offset: 3px;
  font-weight: 600;
}

/* 주어진 문장 (문장 삽입) */
.ss-given-sentence {
  font-size: 0.85rem;
  color: var(--sand-light, #e8dcc8);
  line-height: 1.7;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
  background: rgba(91, 155, 213, 0.12);
  border: 1px solid rgba(91, 155, 213, 0.35);
  border-radius: var(--radius-xs, 4px);
}

/* 선택지 */
.ss-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ss-option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  background: rgba(11, 16, 38, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
  font-family: var(--font-main);
  color: var(--sand);
  font-size: 0.88rem;
  line-height: 1.5;
}

.ss-option:hover {
  border-color: rgba(91, 155, 213, 0.5);
  background: rgba(91, 155, 213, 0.06);
}

.ss-option.selected {
  border-color: #5b9bd5;
  border-width: 2px;
  background: rgba(91, 155, 213, 0.15);
  box-shadow: 0 0 10px rgba(91, 155, 213, 0.25);
}

.ss-option:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.ss-option-marker {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sand-dark);
}

.ss-option.selected .ss-option-marker {
  background: #5b9bd5;
  color: white;
}

.ss-option-text {
  flex: 1;
}

/* 문장 배열 */
.ss-sentence-order {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ss-sentence-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  background: rgba(11, 16, 38, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ss-sentence-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(91, 155, 213, 0.15);
  font-size: 0.78rem;
  font-weight: 700;
  color: #5b9bd5;
}

.ss-sentence-text {
  flex: 1;
  font-size: 0.85rem;
  color: var(--sand);
  line-height: 1.5;
}

.ss-sentence-controls {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ss-sentence-up,
.ss-sentence-down {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--sand-dark);
  cursor: pointer;
  font-size: 0.65rem;
  padding: 2px 6px;
  font-family: var(--font-main);
  transition: all 0.15s;
}

.ss-sentence-up:hover:not(:disabled),
.ss-sentence-down:hover:not(:disabled) {
  border-color: #5b9bd5;
  color: #5b9bd5;
}

.ss-sentence-up:disabled,
.ss-sentence-down:disabled {
  opacity: 0.3;
  cursor: default;
}

/* 듣기 플레이어 */
.ss-listening-player {
  text-align: center;
  padding: 1rem;
  margin-bottom: 0.8rem;
}

.ss-play-btn {
  font-size: 1rem;
  padding: 0.7rem 2rem;
}

/* 하단 액션 */
.ss-quiz-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.ss-quiz-actions .btn {
  min-width: 100px;
}

/* === 결과 화면 === */
.ss-result-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.ss-result-score-big {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin: 0.5rem 0;
}

.ss-result-score-unit {
  font-size: 1.2rem;
  color: var(--sand-dark);
  margin-left: 0.2rem;
}

.ss-result-summary {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  font-size: 0.88rem;
  color: var(--sand-dark);
}

/* 유형별 통계 */
.ss-result-types {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--night-card-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.ss-type-stat {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.ss-type-stat-name {
  font-size: 0.82rem;
  color: var(--sand-dark);
  min-width: 70px;
}

.ss-type-stat-score {
  font-size: 0.78rem;
  color: var(--sand);
  min-width: 70px;
  text-align: right;
}

.ss-type-stat-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.ss-type-stat-fill {
  height: 100%;
  background: #5b9bd5;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* 상세 해설 */
.ss-result-detail-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--sand);
  margin-bottom: 0.8rem;
}

.ss-result-details {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.ss-result-item {
  padding: 1rem;
  background: var(--night-card-50);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sage);
  border-radius: var(--radius-sm);
}

.ss-result-item.wrong {
  border-left-color: var(--rose);
}

.ss-result-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--sand);
}

.ss-result-page {
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  color: var(--sand-muted);
}

.ss-result-question {
  font-size: 0.85rem;
  color: var(--sand);
  line-height: 1.6;
  margin-bottom: 0.6rem;
}

.ss-result-question .ss-passage {
  font-size: 0.78rem;
  margin-bottom: 0.5rem;
}

.ss-result-question .ss-question-text {
  padding: 0;
  background: none;
  border: none;
  margin-bottom: 0;
}

.ss-result-script {
  font-size: 0.78rem;
  color: var(--sand-dark);
  padding: 0.6rem;
  background: rgba(11, 16, 38, 0.4);
  border-radius: var(--radius-xs);
  margin-bottom: 0.5rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.ss-result-answers {
  font-size: 0.82rem;
  color: var(--sand);
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ss-result-answers .correct {
  color: var(--sage);
  font-weight: 600;
}

.ss-result-answers .wrong {
  color: var(--rose);
  font-weight: 600;
}

/* 해설 박스 */
.ss-explanation {
  font-size: 0.8rem;
  color: var(--sand-dark);
  line-height: 1.6;
  padding: 0.7rem;
  background: rgba(91, 155, 213, 0.06);
  border: 1px solid rgba(91, 155, 213, 0.15);
  border-radius: var(--radius-xs);
  white-space: pre-wrap;
}

/* 결과 하단 액션 */
.ss-result-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  padding-bottom: 2rem;
}

.ss-result-actions .btn {
  min-width: 120px;
}

/* === 전체문제보기 (시험/모평 공용) === */
.ss-fullexam-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 16, 38, 0.95);
  backdrop-filter: blur(8px);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

/* 모평: 타이머 항상 화면 상단 고정 */
.ss-fullexam-header--fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: 780px;
  margin: 0 auto;
  z-index: 100;
}

.ss-fullexam-body--fixed-offset {
  padding-top: 56px;
}

/* 일시정지 버튼 */
.ss-pause-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--sand-dark);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-main);
  padding: 0;
}

.ss-pause-btn:hover {
  background: rgba(91, 155, 213, 0.15);
  border-color: #5b9bd5;
  color: #5b9bd5;
}

.ss-pause-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.ss-fullexam-timer {
  font-size: 1rem;
  font-weight: 700;
  color: var(--sage);
  font-family: 'D2Coding', monospace;
  min-width: 50px;
}

.ss-fullexam-timer.warn {
  color: var(--rose);
  animation: ss-blink 0.5s ease-in-out infinite alternate;
}

.ss-fullexam-progress {
  font-size: 0.82rem;
  color: var(--sand-dark);
  flex: 1;
}

.ss-fullexam-submit {
  font-size: 0.85rem;
  padding: 0.4rem 1.2rem;
}

.ss-fullexam-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem 0;
}

.ss-fullexam-question {
  padding: 1.2rem;
  background: var(--night-card-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.ss-fullexam-question.answered {
  border-color: rgba(91, 155, 213, 0.4);
}

.ss-fullexam-q-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.ss-fullexam-q-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(91, 155, 213, 0.15);
  color: #5b9bd5;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ss-fullexam-question.answered .ss-fullexam-q-num {
  background: #5b9bd5;
  color: white;
}

.ss-fullexam-q-type {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  background: rgba(91, 155, 213, 0.12);
  color: #5b9bd5;
  border-radius: 4px;
  font-weight: 600;
}

.ss-fullexam-footer {
  padding: 1.5rem 0 2rem;
  text-align: center;
}

.ss-fullexam-footer .btn {
  min-width: 200px;
  font-size: 1rem;
  padding: 0.8rem 2rem;
}

/* === 수학 기호 툴바 === */
.ss-math-symbols {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
}
.ss-math-symbols button {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.4rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--sand);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: 'Cambria Math', 'STIX Two Math', serif;
}
.ss-math-symbols button:hover {
  background: rgba(240, 160, 48, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}
.ss-math-symbols button:active {
  transform: scale(0.92);
}

/* === 서술형 입력 === */
.ss-essay-input {
  width: 100%;
  min-height: 120px;
  padding: 0.8rem;
  background: rgba(11, 16, 38, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--sand);
  font-size: 0.88rem;
  font-family: var(--font-main);
  line-height: 1.7;
  resize: vertical;
  transition: border-color 0.2s;
}

.ss-essay-input:focus {
  border-color: #5b9bd5;
  outline: none;
}

.ss-essay-input::placeholder {
  color: var(--sand-muted);
}

.ss-badge-essay {
  font-size: 0.68rem;
  padding: 0.12rem 0.4rem;
  background: rgba(240, 160, 48, 0.18);
  color: var(--gold);
  border-radius: 4px;
  font-weight: 700;
}

.ss-essay-meta {
  font-size: 0.75rem;
  color: var(--sand-dark);
  margin-top: 0.3rem;
}

/* === 월 선택 그리드 === */
.ss-month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.6rem;
  max-width: 540px;
}

.ss-month-btn {
  padding: 1rem;
  background: var(--night-card-70);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--sand);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.ss-month-btn:hover {
  border-color: #5b9bd5;
  background: rgba(91, 155, 213, 0.1);
  color: #5b9bd5;
}

.ss-month-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.ss-month-progress {
  display: block;
  font-size: 0.72rem;
  color: var(--sand-dark);
  margin-top: 0.4rem;
  font-weight: 400;
}

/* === 다중 PDF 파일 목록 === */
.ss-file-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ss-file-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: rgba(91, 155, 213, 0.08);
  border: 1px solid rgba(91, 155, 213, 0.2);
  border-radius: var(--radius-sm);
}

.ss-file-item-name {
  flex: 1;
  font-size: 0.85rem;
  color: var(--sand);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-file-item-pages {
  font-size: 0.75rem;
  color: var(--sand-dark);
  flex-shrink: 0;
}

.ss-file-item-remove {
  background: none;
  border: none;
  color: var(--sand-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem;
  transition: color 0.15s;
  font-family: var(--font-main);
  flex-shrink: 0;
}

.ss-file-item-remove:hover {
  color: var(--rose);
}

.ss-add-file-btn {
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  margin-top: 0.3rem;
}

/* === 페이지별 학습 진행바 === */
.ss-page-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: var(--sand-dark);
}

.ss-page-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.ss-page-progress-fill {
  height: 100%;
  background: #5b9bd5;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* === 채점 중 로딩 === */
.ss-grading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 1rem;
  min-height: 300px;
}

.ss-grading-text {
  font-size: 1rem;
  color: var(--sand);
  font-weight: 600;
}

.ss-grading-sub {
  font-size: 0.82rem;
  color: var(--sand-dark);
  text-align: center;
}

/* === 서술형 결과 === */
.ss-essay-result {
  margin-top: 0.6rem;
  padding: 0.8rem;
  background: rgba(240, 160, 48, 0.06);
  border: 1px solid rgba(240, 160, 48, 0.2);
  border-radius: var(--radius-sm);
}

.ss-essay-score {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.ss-essay-feedback {
  font-size: 0.82rem;
  color: var(--sand);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.ss-essay-sample {
  font-size: 0.8rem;
  color: var(--sand-dark);
  line-height: 1.6;
  padding: 0.6rem;
  background: rgba(11, 16, 38, 0.4);
  border-radius: var(--radius-xs);
}

.ss-essay-sample strong {
  color: var(--sand);
}

/* === 번호 전용 선택지 (가로 원형 버튼) === */
.ss-marker-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  padding: 0.8rem 0;
}

.ss-marker-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: rgba(11, 16, 38, 0.5);
  color: var(--sand);
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ss-marker-btn:hover {
  border-color: rgba(91, 155, 213, 0.6);
  background: rgba(91, 155, 213, 0.1);
  transform: scale(1.08);
}

.ss-marker-btn.selected {
  border-color: #5b9bd5;
  border-width: 3px;
  background: rgba(91, 155, 213, 0.3);
  color: #5b9bd5;
  box-shadow: 0 0 14px rgba(91, 155, 213, 0.4);
  transform: scale(1.05);
}

.ss-marker-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* 지문 내 번호 하이라이트 */
.ss-marker-highlight {
  color: #5b9bd5;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(91, 155, 213, 0.5);
  text-underline-offset: 3px;
}

/* === 모평 문제 유형 (5지선다 마커) === */
.ss-option-marker-5 {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sand-dark);
}

.ss-option.selected .ss-option-marker-5 {
  color: #5b9bd5;
}

/* === PDF 읽기 모드: main-content 좌우 패딩 제거 (PDF 꽉 차게) === */
.main-content:has(.ss-pdf-reading-container) {
  padding-left: 0;
  padding-right: 0;
}

/* === PDF 캔버스 읽기 영역 (암기학습 스타일) === */
.ss-pdf-reading-container {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ss-pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: rgba(11, 16, 38, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.ss-pdf-page-info {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--sand-dark);
  font-weight: 600;
  font-family: 'D2Coding', monospace;
}

.ss-pdf-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.ss-pdf-progress-fill {
  height: 100%;
  background: #5b9bd5;
  transition: width 0.3s ease;
}

.ss-pdf-canvas-wrapper {
  background: rgba(11, 16, 38, 0.4);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.ss-pdf-canvas-wrapper canvas {
  display: block;
  max-width: 100%;
}

.ss-pdf-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: rgba(11, 16, 38, 0.8);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.ss-pdf-filename {
  font-size: 0.78rem;
  color: var(--sand-dark);
  text-align: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === 페이지 퀴즈 오버레이 모달 === */
.ss-quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ss-quiz-modal {
  background: var(--bg-surface, rgba(15, 22, 50, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* === 반응형 === */
@media (max-width: 480px) {
  .ss-page-title {
    font-size: 1.1rem;
  }

  .ss-subject-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .ss-subject-icon .icon-lg {
    width: 4.2rem;
    height: 4.2rem;
  }

  .ss-subject-name {
    font-size: 0.92rem;
  }

  .ss-grade-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .ss-mode-card {
    padding: 1rem;
    gap: 0.7rem;
  }

  .ss-mode-icon {
    font-size: 1.4rem;
  }

  .ss-quiz-actions {
    flex-direction: row;
  }

  .ss-result-score-big {
    font-size: 2.8rem;
  }

  .ss-result-summary {
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.82rem;
  }

  .ss-nav-dots {
    gap: 3px;
  }

  .ss-nav-dot {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
  }

  .ss-type-stat {
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .ss-fullexam-header {
    padding: 0.5rem 0.6rem;
    gap: 0.5rem;
  }

  .ss-fullexam-body--fixed-offset {
    padding-top: 48px;
  }

  .ss-fullexam-question {
    padding: 0.8rem;
  }

  .ss-month-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ss-essay-input {
    min-height: 100px;
  }

  .ss-marker-btn {
    width: 42px;
    height: 42px;
    font-size: 1.05rem;
  }

  .ss-marker-options {
    gap: 0.5rem;
  }

  .ss-pdf-toolbar {
    padding: 0.4rem 0.5rem;
    gap: 0.4rem;
  }

  .ss-pdf-nav {
    padding: 0.4rem 0.5rem;
  }

  .ss-quiz-modal {
    padding: 1rem;
    max-height: 85vh;
  }
}

/* === 이어풀기 카드 === */
.ss-resume-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: rgba(91, 155, 213, 0.1);
  border: 1px solid rgba(91, 155, 213, 0.4);
  border-left: 3px solid #5b9bd5;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
  font-family: var(--font-main);
  color: inherit;
  margin-bottom: 1rem;
}

.ss-resume-card:hover {
  background: rgba(91, 155, 213, 0.18);
  transform: translateY(-1px);
}

.ss-resume-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.ss-resume-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.ss-resume-body {
  flex: 1;
  min-width: 0;
}

.ss-resume-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #5b9bd5;
  margin-bottom: 0.2rem;
}

.ss-resume-desc {
  font-size: 0.78rem;
  color: var(--sand-dark);
  line-height: 1.4;
}

.ss-resume-discard {
  background: none;
  border: 1px solid var(--border);
  color: var(--sand-muted);
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-main);
  flex-shrink: 0;
}

.ss-resume-discard:hover {
  border-color: var(--rose);
  color: var(--rose-light);
  background: rgba(232, 93, 117, 0.1);
}

/* === 페이지 전환 fade-in === */
@keyframes ss-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ss-page-title,
.ss-page-desc,
.ss-subject-grid,
.ss-grade-grid,
.ss-mode-cards,
.ss-month-grid,
.ss-result-header,
.ss-fullexam-body {
  animation: ss-fadeIn 0.3s ease-out;
}

/* === 결과 점수 카운트업 === */
@keyframes ss-scoreReveal {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.ss-result-score-big {
  animation: ss-scoreReveal 0.5s ease-out;
}

/* === 모드 카드 태블릿 2열 === */
@media (min-width: 600px) {
  .ss-mode-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .ss-mode-card {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .ss-mode-arrow {
    display: none;
  }
}

/* === 지문 모바일 가독성 향상 === */
@media (max-width: 480px) {
  .ss-passage {
    font-size: 0.88rem;
    line-height: 1.9;
    padding: 0.9rem;
  }

  .ss-question-text {
    font-size: 0.9rem;
  }
}

/* === reduced-motion === */
@media (prefers-reduced-motion: reduce) {
  .ss-subject-card:hover,
  .ss-mode-card:hover {
    transform: none;
  }

  .ss-loading-spinner,
  .ss-loading-spinner-sm {
    animation: none;
    border-top-color: #5b9bd5;
  }

  .ss-timer-warn {
    animation: none;
    opacity: 1;
  }

  .ss-mode-card:hover .ss-mode-arrow {
    transform: none;
  }

  .ss-marker-btn:hover,
  .ss-marker-btn.selected {
    transform: none;
  }

  .ss-page-title,
  .ss-page-desc,
  .ss-subject-grid,
  .ss-grade-grid,
  .ss-mode-cards,
  .ss-month-grid,
  .ss-result-header,
  .ss-fullexam-body,
  .ss-result-score-big {
    animation: none;
  }
}

/* === 해설 로딩 스피너 (지연 로딩) === */
.ss-explanation-loading {
  color: var(--sand-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem;
  font-size: 0.82rem;
}
.ss-loading-spinner-sm {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--amber, #f0a030);
  border-radius: 50%;
  animation: ss-spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ==================== 수학 내신 전용 스타일 ==================== */

/* KaTeX 다크 테마 호환 */
.katex { color: var(--sand); }
.katex-display { margin: 0.5rem 0; overflow-x: auto; overflow-y: hidden; }
.katex-display > .katex { white-space: normal; }

/* 시험 범위 미리보기 */
.ss-math-scope-preview {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  background: rgba(232, 112, 64, 0.08);
  border: 1px solid rgba(232, 112, 64, 0.2);
  border-radius: var(--radius-sm);
}
.ss-math-scope-units {
  margin-top: 0.3rem;
  color: var(--sand);
  font-weight: 600;
}

/* 소단원 선택 */
.ss-math-select-all-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  font-size: 0.9rem;
  color: var(--sand);
  cursor: pointer;
}
.ss-math-units-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}
.ss-math-unit-group {
  padding: 0.8rem;
  background: var(--night-card-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.ss-math-unit-name {
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.ss-math-subunit-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--sand);
  cursor: pointer;
}
.ss-math-subunit-label input[type="checkbox"] {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
}
/* 단원 그룹 구분 헤더 (시험 범위 / 기타 단원 / 선택과목) */
.ss-math-section-label {
  margin: 1rem 0 0.4rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sand);
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--sand-dark);
  border-radius: var(--radius-xs);
}
.ss-math-section-label:first-child {
  margin-top: 0;
}
.ss-math-section-exam {
  color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(240, 160, 48, 0.06);
}
.ss-math-section-elective {
  color: var(--sage);
  border-left-color: var(--sage);
  background: rgba(156, 191, 137, 0.06);
}

/* 수학 이미지 (도형/그래프) */
.ss-math-image {
  text-align: center;
  margin: 0.5rem 0;
}
.ss-math-image img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-sm);
  background: #fff;
}

/* 풀이 과정 */
.ss-math-solution {
  margin-top: 0.6rem;
  padding: 0.7rem;
  background: rgba(91, 155, 213, 0.06);
  border: 1px solid rgba(91, 155, 213, 0.15);
  border-radius: var(--radius-xs);
}
.ss-math-solution-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #5b9bd5;
  margin-bottom: 0.4rem;
}
.ss-math-steps {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.82rem;
  color: var(--sand);
  line-height: 1.7;
}
.ss-math-steps li {
  margin-bottom: 0.2rem;
}

/* 사용된 공식 */
.ss-math-formulas {
  margin-top: 0.5rem;
  padding: 0.6rem 0.7rem;
  background: rgba(240, 160, 48, 0.06);
  border: 1px solid rgba(240, 160, 48, 0.15);
  border-radius: var(--radius-xs);
}
.ss-math-formulas-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.ss-math-formula-item {
  font-size: 0.85rem;
  color: var(--sand);
  padding: 0.25rem 0;
  line-height: 1.6;
}

/* 난이도 배지 */
.ss-math-diff-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 8px;
  margin-left: 0.3rem;
  font-weight: 600;
}
.ss-math-diff-easy { background: rgba(156, 191, 137, 0.2); color: var(--sage); }
.ss-math-diff-medium { background: rgba(240, 160, 48, 0.2); color: var(--gold); }
.ss-math-diff-hard { background: rgba(212, 134, 111, 0.2); color: var(--rose); }

/* 난이도 통계 칩 */
.ss-math-diff-stats {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.ss-math-diff-chip {
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  font-weight: 600;
}

/* 소단원 배지 */
.ss-math-unit-badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  margin-left: 0.3rem;
  background: rgba(91, 155, 213, 0.15);
  color: #5b9bd5;
}

/* === 수학 2열 레이아웃 (좌: 범위, 우: 선택과목) === */
.ss-math-unit-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1rem;
}

.ss-math-unit-layout-left,
.ss-math-unit-layout-right {
  min-width: 0;
}

.ss-math-unit-layout-right {
  border-left: 1px solid var(--border);
  padding-left: 1.2rem;
}

@media (max-width: 640px) {
  .ss-math-unit-layout {
    grid-template-columns: 1fr;
  }
  .ss-math-unit-layout-right {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
  }
}

/* 단답형 입력 */
.ss-short-answer-input {
  width: 120px;
  padding: 0.5rem 0.7rem;
  font-size: 1.1rem;
  font-family: var(--font-main);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--night-card-50);
  color: var(--sand);
  text-align: center;
  transition: border-color 0.2s;
}

.ss-short-answer-input:focus {
  border-color: var(--gold);
  outline: none;
}

.ss-short-answer-input::placeholder {
  color: var(--sand-dark);
  font-size: 0.8rem;
}

.ss-short-answer-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.ss-short-answer-label {
  color: var(--sand-dark);
  font-size: 0.85rem;
}

/* 공식암기 누적 범위 토글 */
.ss-formula-accumulate-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--night-card-50);
  color: var(--sand);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.85rem;
  transition: all 0.2s;
  margin-bottom: 1rem;
}

.ss-formula-accumulate-btn.active {
  border-color: var(--gold);
  background: rgba(240, 160, 48, 0.1);
  color: var(--gold);
}

.ss-formula-accumulate-btn:hover {
  border-color: var(--gold);
}

/* 수학 모평 선택과목 카드 */
.ss-math-elective-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.ss-math-elective-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1.2rem 0.8rem;
  background: var(--night-card-70);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-main);
  color: var(--sand);
  font-size: 0.95rem;
  font-weight: 600;
}

.ss-math-elective-card:hover {
  border-color: #e87040;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.ss-math-elective-card.selected {
  border-color: #e87040;
  background: rgba(232, 112, 64, 0.12);
  color: #e87040;
}

.ss-math-elective-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.ss-math-elective-desc {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--sand-dark);
  text-align: center;
}

/* 수학 모평 진행 상황 (선택과목별) */
.ss-math-mock-progress {
  font-size: 0.72rem;
  color: var(--sand-dark);
  margin-top: 0.3rem;
}

/* === 공식 검색 === */
.ss-formula-search-container {
  margin-top: 0.5rem;
}

.ss-formula-search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ss-formula-search-input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: rgba(11, 16, 38, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--sand);
  font-size: 0.9rem;
  font-family: var(--font-main);
  transition: border-color 0.2s;
}

.ss-formula-search-input:focus {
  border-color: #e87040;
  outline: none;
}

.ss-formula-search-input::placeholder {
  color: var(--sand-muted);
}

.ss-formula-search-filter {
  padding: 0.5rem 0.7rem;
  background: var(--night-card-70);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--sand);
  font-size: 0.82rem;
  font-family: var(--font-main);
  cursor: pointer;
  min-width: 90px;
}

.ss-formula-search-filter:focus {
  border-color: #e87040;
  outline: none;
}

.ss-formula-search-results {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.ss-formula-search-empty {
  text-align: center;
  color: var(--sand-muted);
  font-size: 0.88rem;
  padding: 2rem 0;
}

.ss-formula-card {
  padding: 0.8rem 1rem;
  background: rgba(21, 32, 66, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}

.ss-formula-card:hover {
  border-color: rgba(232, 112, 64, 0.4);
}

.ss-formula-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.ss-formula-card-grade {
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  background: rgba(232, 112, 64, 0.15);
  color: #e87040;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.ss-formula-card-unit {
  font-size: 0.78rem;
  color: var(--sand-dark);
}

.ss-formula-card-sub {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.ss-formula-card-formulas {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ss-formula-card-item {
  font-size: 0.88rem;
  color: var(--sand);
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-xs);
  line-height: 1.7;
}

/* === 누적 범위 학년 체크박스 === */
.ss-accum-grades-wrap {
  margin-bottom: 1rem;
}

.ss-accum-grades-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.6rem 0.8rem;
  background: var(--night-card-70);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  margin-top: -0.5rem;
  margin-bottom: 0.5rem;
}

.ss-accum-grade-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--sand);
  cursor: pointer;
}

.ss-accum-grade-item input[type="checkbox"] {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
}

/* 반응형: 공식 검색 */
@media (max-width: 480px) {
  .ss-formula-search-bar {
    flex-direction: column;
  }

  .ss-formula-search-filter {
    min-width: unset;
  }

  .ss-formula-search-results {
    max-height: 55vh;
  }
}

/* ==================== 영단어 암기 (Vocab Quiz) ==================== */

/* 레벨/스테이지 선택 */
.vq-level-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.vq-level-card {
  background: var(--night-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-main);
}

.vq-level-card:hover,
.vq-level-card:focus-visible {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(244, 197, 66, 0.15);
}

.vq-level-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.vq-level-name {
  color: var(--sand);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.vq-level-desc {
  color: var(--sand-dark);
  font-size: 0.8rem;
}

/* 스테이지 그리드 */
.vq-stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.vq-stage-card {
  background: var(--night-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-main);
  position: relative;
  overflow: hidden;
}

.vq-stage-card:hover,
.vq-stage-card:focus-visible {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.vq-stage-card.completed {
  border-color: var(--sage);
  background: rgba(123, 198, 126, 0.08);
}

.vq-stage-card.current {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(244, 197, 66, 0.2);
}

.vq-stage-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.vq-stage-num {
  color: var(--gold);
  font-size: 1.3rem;
  font-weight: 700;
}

.vq-stage-title {
  color: var(--sand-dark);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.vq-stage-progress {
  margin-top: 0.5rem;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.vq-stage-progress-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.vq-stage-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.85rem;
}

/* 퀴즈 UI */
.vq-quiz-container {
  max-width: 540px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

/* 진행 바 */
.vq-progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.vq-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  background: linear-gradient(90deg, var(--gold), var(--sage));
}

/* 라운드/진행 정보 */
.vq-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.vq-round-badge {
  background: rgba(244, 197, 66, 0.15);
  color: var(--gold);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.vq-count-badge {
  color: var(--sand-dark);
  font-size: 0.8rem;
}

/* 단어 카드 */
.vq-word-card {
  background: var(--night-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.vq-word-en {
  color: var(--sand);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  font-family: 'Noto Serif KR', serif;
}

/* 마스터리 도트 (5개 원) */
.vq-mastery-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 0.5rem;
}

.vq-mastery-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  transition: all 0.3s ease;
}

.vq-mastery-dot.filled {
  background: var(--sage);
  border-color: var(--sage);
}

/* 보기 버튼들 */
.vq-choices {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.vq-choice-btn {
  background: var(--night-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  color: var(--sand);
  font-size: 1.05rem;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  position: relative;
}

.vq-choice-btn:hover:not(.disabled) {
  border-color: rgba(255,255,255,0.35);
  background: #1e3060;
}

.vq-choice-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* 힌트 색상 — 정답 보기에만 적용 */
.vq-choice-btn.hint-blue {
  border-color: #5b9bd5;
  color: #5b9bd5;
  background: #152a4a;
  font-weight: 600;
}

.vq-choice-btn.hint-red {
  border-color: #e85d75;
  color: #e85d75;
  background: #2e1a2a;
  font-weight: 600;
}

.vq-choice-btn.hint-yellow {
  border-color: #f0a030;
  color: #f0a030;
  background: #2a2215;
  font-weight: 600;
}

/* 정답/오답 피드백 */
.vq-choice-btn.correct {
  border-color: var(--sage);
  background: rgba(123, 198, 126, 0.15);
  color: var(--sage);
  font-weight: 600;
}

.vq-choice-btn.wrong {
  border-color: var(--rose);
  background: rgba(232, 93, 117, 0.1);
  color: var(--rose);
  opacity: 0.7;
}

.vq-choice-btn.disabled {
  pointer-events: none;
}

/* 정답 피드백 아이콘 */
.vq-choice-btn .vq-feedback-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

/* 다음 버튼 */
.vq-next-btn {
  display: none;
  width: 100%;
  margin-top: 1rem;
  padding: 0.85rem;
  background: var(--gold);
  color: var(--night);
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.vq-next-btn.show {
  display: block;
}

.vq-next-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* 오답 시 정답 표시 */
.vq-correct-reveal {
  text-align: center;
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  background: rgba(123, 198, 126, 0.1);
  border: 1px solid rgba(123, 198, 126, 0.3);
  border-radius: 10px;
  color: var(--sage);
  font-size: 0.9rem;
  font-weight: 600;
  animation: vqFadeIn 0.3s ease;
}

@keyframes vqFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes vqPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* 라운드 요약 */
.vq-summary {
  max-width: 540px;
  margin: 0 auto;
}

.vq-summary-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.vq-summary-title {
  color: var(--gold);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.vq-summary-stats {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 0.75rem;
}

.vq-summary-stat {
  text-align: center;
}

.vq-summary-stat-num {
  font-size: 1.8rem;
  font-weight: 700;
  display: block;
}

.vq-summary-stat-num.green { color: var(--sage); }
.vq-summary-stat-num.red { color: var(--rose); }
.vq-summary-stat-num.gold { color: var(--gold); }

.vq-summary-stat-label {
  font-size: 0.75rem;
  color: var(--sand-dark);
}

/* 오답 단어 리스트 */
.vq-wrong-list {
  background: var(--night-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
}

.vq-wrong-list-title {
  color: var(--rose);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.vq-wrong-item {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.85rem;
}

.vq-wrong-item:last-child { border-bottom: none; }

.vq-wrong-en { color: var(--sand); font-weight: 600; }
.vq-wrong-ko { color: var(--sand-dark); }

/* 요약 버튼 */
.vq-summary-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.vq-summary-actions .btn {
  flex: 1;
}

/* 스테이지 완료 */
.vq-complete {
  text-align: center;
  max-width: 540px;
  margin: 0 auto;
}

.vq-complete-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: vqPulse 1.5s ease infinite;
}

.vq-complete-title {
  color: var(--gold);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.vq-complete-desc {
  color: var(--sand-dark);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.vq-complete-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.vq-complete-stat {
  text-align: center;
}

.vq-complete-stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
}

.vq-complete-stat-label {
  font-size: 0.8rem;
  color: var(--sand-dark);
}

.vq-complete-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* 전체 진행 대시보드 */
.vq-dashboard {
  margin-top: 1rem;
}

.vq-mastered-count {
  text-align: center;
  color: var(--sand-dark);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.vq-mastered-count strong {
  color: var(--gold);
}

/* 반응형 */
@media (max-width: 480px) {
  .vq-level-grid {
    grid-template-columns: 1fr;
  }

  .vq-stage-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .vq-word-en {
    font-size: 1.6rem;
  }

  .vq-choice-btn {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  .vq-summary-stats {
    gap: 1rem;
  }

  .vq-complete-stats {
    gap: 1rem;
  }
}

/* ========================================
   학습 경로 추천 카드
   ======================================== */
.study-path-card {
  padding: 1.25rem;
  margin-bottom: 1.2rem;
  background: linear-gradient(135deg, var(--night-card), rgba(244, 197, 66, 0.03));
  border: 1px solid rgba(244, 197, 66, 0.15);
  border-radius: var(--radius);
}

.study-path-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.study-path-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
}

.study-path-subject {
  font-size: 0.75rem;
  color: var(--sand-muted);
}

.study-path-stages {
  display: flex;
  flex-direction: column;
}

.study-path-stage {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
}

.stage-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
  color: var(--sand-muted);
  background: var(--night);
  transition: all 0.25s ease;
}

/* 완료 단계 */
.study-path-stage.completed .stage-dot {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}

/* 현재 단계 */
.study-path-stage.current .stage-dot {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--night);
  box-shadow: 0 0 8px rgba(244, 197, 66, 0.4);
}

/* 잠긴 단계 */
.study-path-stage.locked {
  opacity: 0.45;
}

.stage-info {
  flex: 1;
  min-width: 0;
}

.stage-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sand);
}

.stage-desc {
  font-size: 0.72rem;
  color: var(--sand-muted);
  margin-top: 0.1rem;
}

/* 단계 연결선 */
.stage-connector {
  width: 2px;
  height: 16px;
  background: var(--border);
  margin-left: 15px;
  transition: background 0.25s ease;
}

.stage-connector.done {
  background: var(--sage);
}

/* 시작 버튼 */
.stage-start-btn {
  flex-shrink: 0;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--gold);
  color: var(--night);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-main);
}

.stage-start-btn:hover {
  background: #e0a020;
  transform: translateX(2px);
}

.stage-start-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* 모바일 대응 */
@media (max-width: 480px) {
  .study-path-card {
    padding: 1rem;
  }

  .study-path-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .stage-start-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
  }
}

/* ===== 사전 팝업 (Free Dictionary API) ===== */
.dict-popup {
  position: fixed;
  z-index: 10000;
  max-width: 340px;
  width: calc(100vw - 32px);
  max-height: 300px;
  overflow-y: auto;
  background: var(--night-card);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  padding: 0;
  animation: fadeIn 0.2s ease;
}

.dict-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.dict-word {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
}

.dict-phonetic {
  font-size: 0.82rem;
  color: var(--sand-muted);
}

.dict-audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem;
  border-radius: 50%;
  transition: background 0.2s;
}

.dict-audio-btn:hover {
  background: rgba(244, 197, 66, 0.15);
}

.dict-close-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--sand-muted);
  cursor: pointer;
  font-size: 1rem;
}

.dict-close-btn:hover {
  color: var(--sand);
}

.dict-body {
  padding: 0.75rem 1rem;
}

.dict-meaning {
  margin-bottom: 0.6rem;
}

.dict-pos {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sage);
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.25rem;
}

.dict-def {
  font-size: 0.85rem;
  color: var(--sand);
  line-height: 1.5;
  margin-bottom: 0.2rem;
}

.dict-example {
  font-size: 0.78rem;
  color: var(--sand-muted);
  font-style: italic;
  margin-bottom: 0.4rem;
}

.dict-lookup {
  cursor: pointer;
  border-bottom: 1px dotted var(--gold);
  transition: color 0.2s;
}

.dict-lookup:hover {
  color: var(--gold);
}

/* === 영어사전 모드 === */
.ss-dictionary { max-width: 600px; margin: 0 auto; }
.ss-dict-search {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}
.ss-dict-input {
  flex: 1;
  font-size: 1rem;
}
.ss-dict-result { min-height: 200px; }
.ss-dict-loading, .ss-dict-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--sand-muted);
  font-size: 0.9rem;
}
.ss-dict-entry {
  padding: 1rem;
  background: var(--night-card-70);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ss-dict-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.ss-dict-word {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
}
.ss-dict-phonetic {
  font-size: 0.9rem;
  color: var(--sand-muted);
}
.ss-dict-play-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 50%;
  transition: background 0.2s;
}
.ss-dict-play-btn:hover {
  background: rgba(244, 197, 66, 0.15);
}
.ss-dict-meaning {
  margin-bottom: 0.75rem;
}
.ss-dict-pos {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sage);
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 0.3rem;
  padding: 0.1rem 0.4rem;
  background: rgba(123, 198, 126, 0.1);
  border-radius: 4px;
}
.ss-dict-def {
  font-size: 0.9rem;
  color: var(--sand);
  line-height: 1.6;
  margin: 0.2rem 0;
}
.ss-dict-translate-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.1rem 0.3rem;
  margin-left: 0.3rem;
  opacity: 0.5;
  transition: opacity 0.2s;
  vertical-align: middle;
}
.ss-dict-translate-btn:hover { opacity: 1; }
.ss-dict-translated {
  margin: 0.15rem 0 0.3rem 1rem;
  padding: 0.2rem 0;
}
.ss-dict-example {
  font-size: 0.82rem;
  color: var(--sand-muted);
  font-style: italic;
  margin: 0.1rem 0 0.5rem 1rem;
}

/* KRDict 한국어 뜻 */
.dict-kr-section, .ss-dict-kr {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.dict-kr-title, .ss-dict-kr-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 0.4rem;
}
.dict-kr-item, .ss-dict-kr-item {
  margin-bottom: 0.5rem;
}
.dict-kr-word {
  font-weight: 700;
  color: var(--sand);
  font-size: 0.88rem;
}
.dict-kr-pos {
  font-size: 0.7rem;
  color: var(--sand-muted);
  margin-left: 0.3rem;
}
.dict-kr-def {
  font-size: 0.82rem;
  color: var(--sand);
  line-height: 1.5;
  margin-top: 0.15rem;
}

/* ══ 사전 검색 기록 ══ */
.ss-dict-history {
  margin: 0 0 1rem;
}
.ss-dict-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.ss-dict-history-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
}
.ss-dict-history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.ss-dict-history-chip {
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  background: rgba(244, 197, 66, 0.08);
  border: 1px solid rgba(244, 197, 66, 0.2);
  color: var(--gold);
  cursor: pointer;
  font-family: var(--font-main);
  transition: background 0.2s;
}
.ss-dict-history-chip:hover {
  background: rgba(244, 197, 66, 0.2);
}

/* ══ 플로팅 사전 버튼 (FAB) ══ */
.dict-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(244, 197, 66, 0.4);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.dict-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(244, 197, 66, 0.5);
}
.dict-fab:active { transform: scale(0.95); }

/* 사전 모달 오버레이 */
.dict-fab-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(6, 10, 24, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
.dict-fab-modal {
  background: var(--night-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dict-fab-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.dict-fab-modal-title { font-size: 1rem; font-weight: 700; color: var(--gold); }
.dict-fab-modal-close {
  background: none; border: none; color: var(--sand-muted);
  font-size: 1.2rem; cursor: pointer;
}
.dict-fab-modal-search {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}
.dict-fab-modal-search .form-control { flex: 1; }
.dict-fab-modal-result {
  flex: 1;
  overflow-y: auto;
  padding: 0 1rem 1rem;
}
.dict-fab-entry { margin-bottom: 0.75rem; }
.dict-fab-word {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.dict-fab-play {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; padding: 0.2rem; margin-left: 0.3rem;
}
.dict-fab-pos {
  font-size: 0.72rem; font-weight: 700; color: var(--sage);
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  background: rgba(123, 198, 126, 0.1);
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.3rem;
}
.dict-fab-kr {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* 검색 기록 */
.dict-modal-history {
  padding: 0 1rem 0.5rem;
}
.dict-modal-history-title {
  font-size: 0.72rem;
  color: var(--sand-muted);
  margin-bottom: 0.35rem;
}
.dict-modal-history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.dict-history-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  background: rgba(244, 197, 66, 0.1);
  border: 1px solid rgba(244, 197, 66, 0.2);
  color: var(--gold);
  cursor: pointer;
  font-family: var(--font-main);
  transition: background 0.2s;
}
.dict-history-chip:hover { background: rgba(244, 197, 66, 0.2); }

@media (max-width: 480px) {
  .dict-fab { bottom: 1rem; right: 1rem; width: 46px; height: 46px; font-size: 1.3rem; }
  .dict-fab-modal { max-height: 90vh; }
}

/* ===== 영문법 모드 ===== */
.grammar-topics {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.grammar-topic-card {
  padding: 1rem;
  background: var(--night-card-70);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.grammar-topic-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sand);
  min-width: 120px;
}
.grammar-topic-summary {
  flex: 1;
  font-size: 0.82rem;
  color: var(--sand-muted);
}
.grammar-topic-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* 문법 정리 */
.grammar-rule-card {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--night-card-70);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}
.grammar-rule {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.grammar-example {
  font-size: 0.82rem;
  color: var(--sand);
  font-style: italic;
}

/* 문법 퀴즈 */
.grammar-quiz { max-width: 600px; margin: 0 auto; }
.grammar-quiz-question {
  font-size: 1rem;
  color: var(--sand);
  line-height: 1.7;
  margin: 1rem 0;
  padding: 1rem;
  background: var(--night-card-70);
  border-radius: var(--radius);
  white-space: pre-line;
}
.grammar-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.grammar-option {
  padding: 0.7rem 1rem;
  background: var(--night-card-70);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--sand);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.2s;
}
.grammar-option:hover:not(:disabled) {
  border-color: var(--gold);
}
.grammar-option.correct {
  background: rgba(123,198,126,0.2);
  border-color: var(--sage);
  color: var(--sage);
}
.grammar-option.wrong {
  background: rgba(232,93,117,0.2);
  border-color: var(--rose);
}
.grammar-explanation {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(244,197,66,0.06);
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  color: var(--sand);
  line-height: 1.5;
}
.grammar-explanation strong { color: var(--gold); }

@media (max-width: 480px) {
  .grammar-topic-card { flex-wrap: wrap; }
  .grammar-topic-actions { width: 100%; justify-content: flex-end; }
}


/* 문법 탭 바 */
.grammar-tab-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.grammar-tab {
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--sand-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: var(--font-main);
  transition: all 0.2s;
}
.grammar-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.grammar-tab:hover:not(.active) {
  color: var(--sand);
}

/* 문법 상세 설명 */
.grammar-explanation-text {
  font-size: 0.85rem;
  color: var(--sand);
  line-height: 1.7;
  margin: 0.4rem 0 0.6rem;
  padding: 0.5rem 0.75rem;
  background: rgba(244, 197, 66, 0.04);
  border-radius: var(--radius-xs);
}
.grammar-wrong-example {
  font-size: 0.82rem;
  color: var(--rose-light, #ff8fa3);
  line-height: 1.6;
  margin: 0.3rem 0;
  padding: 0.4rem 0.75rem;
  background: rgba(232, 93, 117, 0.06);
  border-radius: var(--radius-xs);
}
.grammar-tip {
  font-size: 0.82rem;
  color: var(--sage);
  line-height: 1.5;
  margin: 0.3rem 0 0;
  padding: 0.4rem 0.75rem;
  background: rgba(123, 198, 126, 0.06);
  border-radius: var(--radius-xs);
}

/* 문법 섹션 헤더 (학년 구분) */
.grammar-section-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
  padding: 0.6rem 0 0.3rem;
  margin-top: 0.5rem;
  border-bottom: 1px solid rgba(244, 197, 66, 0.15);
}
