:root {
  --scale-factor: 1;
  --primary-bg: #f8fafc;
  --secondary-bg: #ffffff;
  --interaction-bg: #f1f5f9;
  --accent-color: #3182ce;
  --accent-color-rgb: 49, 130, 206;
  --text-main: #1a202c;
  --text-muted: #64748b;
  --header-bg: #ffffff;
  --footer-bg: #f8fafc;
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(0, 0, 0, 0.05);
  --glass-blur: blur(8px);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --card-bg: #ffffff;
  --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.dark-mode {
  --primary-bg: #0f172a;
  --secondary-bg: #1e293b;
  --interaction-bg: #2d3748;
  --accent-color: #38bdf8;
  --accent-color-rgb: 56, 189, 248;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --header-bg: rgba(15, 23, 42, 0.9);
  --footer-bg: #111827;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(12px);
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

html {
  font-size: calc(16px * var(--scale-factor));
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--primary-bg);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  max-width: 1920px;
  margin: 0 auto;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.05);
}

/* Desktop Optimized Sizing */
/* 데스크탑 및 고해상도 모니터 대응 */
@media (min-width: 1024px) {
  :root {
    --scale-factor: 1.2;
  }
}

/* 화면 높이가 낮은 경우를 위한 특수 스케일 조정 (노트북 등) */
@media (max-height: 850px) {
  :root {
    --scale-factor: 1.1;
  }
}

@media (max-height: 700px) {
  :root {
    --scale-factor: 1.0;
  }
}

header {
  padding: 1.5rem 2rem;
  background-color: var(--header-bg);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.3s ease;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  color: var(--accent-color);
}

/* Progress Bar (Footer) */
.footer-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

.progress-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: #94a3b8;
  min-width: 4rem;
}

.progress-bar-container {
  height: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  flex: 1;
  max-width: 30rem;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: #8b3d48;
  /* Northstar specific red/maroon tip */
  width: 0%;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(139, 61, 72, 0.5);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.question-bar {
  background-color: #fce7e9;
  border-bottom: 2px solid #e53e3e;
  padding: 1rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #2d3748;
  font-weight: 500;
  font-size: 1.1rem;
  position: relative;
  /* Critical for absolute dropdown */
}

.interaction-area {
  flex: 1;
  background-color: var(--interaction-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vh, 2rem);
  overflow-y: hidden;
  /* 인트로 및 평가 중 스크롤바 억제 */
  position: relative;
  transition: background-color 0.3s ease;
}

.quiz-card {
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  padding: 3rem;
  width: 100%;
  max-width: 60rem;
  box-shadow: var(--card-shadow);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.quiz-card.animate-in {
  animation: slideUp 0.4s ease-out;
}

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

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

.question-number {
  color: var(--accent-color);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: block;
}

h1 {
  font-size: 2rem;
  margin-bottom: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* Typing Practice Field */
.typing-input-display {
  background: white;
  border: 2px solid #cbd5e0;
  border-radius: 0.5rem;
  padding: 1rem;
  font-size: 1.5rem;
  min-height: 4rem;
  margin-bottom: 1.5rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  font-family: 'Gowun Batang', serif;
  word-break: break-all;
}

.typing-input-display:empty::before {
  content: "여기에 글자가 표시됩니다";
  color: #a0aec0;
  font-size: 1.1rem;
}

.explanation-box {
  background: #fff5f5;
  border-left: 4px solid #f87171;
  padding: 1rem;
  margin-top: 1rem;
  border-radius: 0 0.5rem 0.5rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #4a5568;
}

.explanation-title {
  font-weight: 700;
  color: #e53e3e;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  margin-bottom: 2rem;
  width: 100%;
}

@media (max-width: 640px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
}

.option-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1.25rem;
  color: var(--text-primary);
  font-size: 1.1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.option-btn.icon-option {
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 2rem 1rem;
}

.option-btn.icon-option .option-text {
  font-size: 1.5rem;
  font-weight: 600;
}

.option-btn.icon-option .option-marker {
  position: absolute;
  top: 1rem;
  left: 1rem;
}

.option-marker {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.option-btn.selected {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.footer-controls {
  padding: 1.5rem 2.5rem;
  background: var(--footer-bg);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  transition: background-color 0.3s ease;
}

.footer-right {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background: var(--accent-color);
  color: var(--primary-bg);
}

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

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--glass-border);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Virtual Keyboard Styles */
.keyboard-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem;
  background: #d1d5db;
  /* Light gray base as per image */
  border-radius: 0.5rem;
  margin-top: 1.5rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
}

.key {
  background: #ffffff;
  color: #1f2937;
  padding: 0.8rem 0;
  border-radius: 0.4rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 1.1rem;
  flex: 1;
  text-align: center;
  user-select: none;
  transition: all 0.1s;
  box-shadow: 0 2px 0 #9ca3af;
  border: 1px solid #e5e7eb;
}

.key:active,
.key.pressed {
  transform: translateY(2px) scale(0.95);
  background: var(--accent-color) !important;
  color: white !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

@keyframes keyPress {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.92) translateY(2px);
  }

  100% {
    transform: scale(1);
  }
}

.key-animate {
  animation: keyPress 0.1s ease-out;
}

.key.special {
  background: #f1f5f9;
  /* Much lighter gray */
  color: #4b5563;
  font-size: 0.9rem;
  flex: 1.25;
}

.key.space {
  flex: 4;
}

.key.globe-key {
  font-size: 1.4rem;
  flex: 1.5;
}

.key.enter-key {
  background: #4299e1 !important;
  color: white !important;
  box-shadow: 0 2px 0 #2b6cb0;
  flex: 2.2;
  font-size: 1.2rem;
}

/* Smartphone Mockup Styles */
.phone-mockup {
  width: 100%;
  max-width: 25rem;
  /* Changed to rem */
  background: #000;
  border-radius: 2rem;
  padding: 1rem;
  border: 4px solid #333;
  margin: 2rem auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  position: relative;
}

.status-bar {
  background: #111;
  padding: 0.5rem 1.5rem;
  border-radius: 1rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.5rem;
  height: 40px;
}

.status-icon {
  font-size: 1.25rem;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s;
  padding: 0.25rem;
  border-radius: 0.25rem;
}

.status-icon:hover {
  transform: scale(1.2);
  background: rgba(255, 255, 255, 0.1);
}

.status-icon.selected {
  background: var(--accent-color);
  color: #000;
}

/* Home Screen & Browser Simulation */
.home-screen {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  background: #f1f5f9;
  height: 250px;
  align-content: start;
  transition: background-color 0.3s ease;
}

.dark-mode .home-screen {
  background: #1e293b;
}

.app-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.app-icon:hover {
  transform: scale(1.1);
}

.app-icon span {
  font-size: 2rem;
  background: white;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  /* SVG가 둥근 모서리를 넘지 않도록 */
}

.app-icon span svg {
  display: block;
}

.app-icon label {
  font-size: 0.75rem;
  color: #475569;
  font-weight: 500;
  cursor: pointer;
}

.dark-mode .app-icon label {
  color: #94a3b8;
}

.browser-screen {
  background: white;
  height: 250px;
  display: flex;
  flex-direction: column;
}

.browser-header {
  padding: 0.5rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.browser-address-bar {
  background: #f1f5f9;
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: #64748b;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.browser-address-bar:hover {
  border-color: var(--accent-color);
}

.browser-content {
  flex: 1;
  overflow-y: auto;
}

.browser-footer {
  display: flex;
  justify-content: space-around;
  padding: 0.5rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.browser-footer span {
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 50%;
}

.browser-footer span:hover {
  background: #e2e8f0;
}

.selected {
  background: var(--accent-color) !important;
  color: white !important;
  border-radius: 0.5rem;
}

.key.selected-key {
  background: #4ade80;
  color: #000;
  border-color: #fff;
  transform: scale(0.95);
  box-shadow: 0 0 15px rgba(74, 222, 128, 0.5);
}


.key.shifted {
  background: #2563eb;
  /* 일반 쉬프트: 진한 파란색 */
  color: white;
}

.key.caps-lock {
  background: #38bdf8;
  /* 캡스락: 하늘색 */
  color: white;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
}

.key.space {
  min-width: 12rem;
}

/* Question List (Quick Nav) */
.question-list-overlay {
  position: absolute;
  top: 100%;
  right: 2rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  width: 250px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  animation: slideUp 0.3s ease;
  color: #1f2937;
}

.question-list-overlay.active {
  display: block;
}

.question-list-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.2s;
}

.question-list-item:hover {
  background: #f8fafc;
}

.question-list-item.current {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  font-weight: 700;
}

.question-list-item .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e0;
}

.question-list-item.answered .status-dot {
  background: #4ade80;
}

/* Revisit Warning Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  display: none;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  padding: 2.5rem;
  border-radius: 0.5rem;
  max-width: 500px;
  width: 90%;
  text-align: center;
  color: #333;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

.modal-text {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  line-height: 1.5;
  color: #4a5568;
}

.modal-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-modal-yes {
  background: #718096;
  color: white;
  padding: 0.8rem 1.5rem;
  border-radius: 0.25rem;
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
}

.btn-modal-no {
  background: #8b3d48;
  color: white;
  padding: 0.8rem 1.5rem;
  border-radius: 0.25rem;
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
}

.btn-modal-yes:hover,
.btn-modal-no:hover {
  filter: brightness(1.1);
}

/* --- Certificate System --- */
.certificate-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  backdrop-filter: blur(15px);
  padding: 20px;
}

.certificate-overlay.active {
  opacity: 1;
  visibility: visible;
}

.certificate-box {
  width: 100%;
  max-width: 850px;
  background: #fff;
  padding: 60px;
  border: 12px double #c5a368;
  color: #1a1a1a;
  text-align: center;
  position: relative;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  font-family: 'Gowun Batang', 'Nanum Myeongjo', serif;
  transform: scale(0.9) translateY(20px);
  transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.certificate-overlay.active .certificate-box {
  transform: scale(1) translateY(0);
}

.certificate-box::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  bottom: 15px;
  border: 2px solid #c5a368;
  pointer-events: none;
}

.cert-header h1 {
  font-family: 'Nanum Myeongjo', serif;
  font-weight: 800;
  font-size: 3.5rem;
  margin-bottom: 30px;
  color: #1a1a1a;
  letter-spacing: 5px;
}

.cert-content {
  margin: 50px 0;
  font-size: 1.4rem;
  line-height: 2;
  color: #333;
}

.cert-name {
  font-size: 3rem;
  font-weight: 700;
  color: #000;
  border-bottom: 3px solid #1a1a1a;
  display: inline-block;
  padding: 0 30px;
  margin: 15px 0;
}

.cert-score {
  font-size: 1.3rem;
  color: #666;
  margin-top: 30px;
}

.cert-footer {
  margin-top: 80px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 20px;
}

.cert-date {
  font-size: 1.1rem;
  color: #555;
  text-align: left;
}

.cert-seal {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, #d4af37 0%, #c5a368 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
  font-weight: bold;
  box-shadow: 0 10px 20px rgba(197, 163, 104, 0.4);
  transform: rotate(-15deg);
  border: 2px dashed rgba(255, 255, 255, 0.5);
}

.cert-code {
  position: absolute;
  bottom: 25px;
  left: 30px;
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  color: #aaa;
}

.cert-actions {
  margin-top: 40px;
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.btn-cert {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.btn-print {
  background: #c5a368;
  color: white;
}

.btn-print:hover {
  background: #b49257;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(180, 146, 87, 0.3);
}

.btn-close-cert {
  background: #4b5563;
  color: white;
}

.btn-close-cert:hover {
  background: #374151;
}

/* --- 신규 UI 개편 스타일 --- */

/* 인트로 카드 */
.intro-card {
  width: 95%;
  max-width: 700px;
  margin: 1rem auto;
  background: var(--secondary-bg);
  padding: 2.5rem;
  border-radius: 2rem;
  box-shadow: var(--card-shadow);
  text-align: center;
}

.intro-header {
  margin-bottom: clamp(1.5rem, 3vh, 2.5rem);
}

.intro-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.intro-header h1 {
  font-size: 2.2rem;
  color: var(--text-main);
  line-height: 1.2;
}

.intro-guide-list {
  text-align: left;
  list-style: none;
  background: var(--interaction-bg);
  padding: clamp(1.5rem, 3vh, 2.5rem);
  border-radius: 1.5rem;
  margin-bottom: clamp(1.5rem, 4vh, 2.5rem);
  width: 100%;
}

.intro-guide-list li {
  margin-bottom: 1.25rem;
  font-size: 1.25rem;
  line-height: 1.6;
  position: relative;
  padding-left: 2rem;
  text-align: left;
}

.intro-guide-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: bold;
}

.start-btn {
  width: 100%;
  padding: 1rem;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 1rem;
}

/* 인라인 TTS 및 힌트 버튼 */
.tts-btn-inline {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  vertical-align: middle;
  margin-right: 0.5rem;
  transition: transform 0.2s;
}

.tts-btn-inline:hover {
  transform: scale(1.2);
}

.hint-inline-btn {
  background: #fef3c7;
  border: 1.5px solid #f59e0b;
  color: #d97706;
  padding: 0.3rem 1rem;
  border-radius: 0.5rem;
  font-size: 1.1rem;
  /* 글자 크기 확대 */
  font-weight: 700;
  cursor: pointer;
  margin-left: 0.5rem;
  transition: all 0.2s;
}

.hint-inline-btn:hover {
  background: #f59e0b;
  color: #fff;
}

.hint-text-box {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  padding: 1rem 1.5rem;
  border-radius: 1rem;
  margin-top: 1rem;
  color: #b45309;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.6;
  animation: slideDown 0.3s ease-out;
}

.hint-inline-btn.active {
  background: #f59e0b;
  color: #fff;
}

/* 결과 페이지 힌트 배지 */
.hint-badge {
  display: inline-block;
  font-size: 0.75rem;
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fef3c7;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

/* 별도 인증서 레이아웃 */
.certificate-printable {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
}

.cert-border-outer {
  border: 4px solid #c5a368;
  padding: 20px;
}

.cert-border-inner {
  padding: 30px 40px;
  position: relative;
  background-image: radial-gradient(circle at 50% 50%, rgba(197, 163, 104, 0.05) 0%, transparent 70%);
}

.cert-header h1 {
  font-family: 'Gothic A1', serif;
  font-size: 2.1rem;
  /* 2.8rem의 약 75% (가독성 고려) */
  color: #1a1a1a;
  letter-spacing: 0.8rem;
  margin-top: 5rem;
  margin-bottom: 4rem;
  text-align: center;
}

.cert-body {
  text-align: left;
  line-height: 1.8;
  margin-bottom: 3rem;
}

.cert-row {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
}

.cert-label {
  font-weight: 400;
  margin-right: 2rem;
}

.cert-value {
  font-weight: 700;
}

.name-underline {
  border-bottom: 2px solid #333;
  padding-right: 3rem;
}

.cert-main-text {
  font-size: 1.25rem;
  text-align: center;
  margin: 2rem 0;
}

.module-highlight {
  color: #8b4513;
  font-weight: 700;
  font-size: 1.6rem;
  /* 기존 약 1.1rem 내외에서 150% 수준으로 확대 */
  display: inline-block;
  margin-top: 0.5rem;
}

.cert-score-display {
  text-align: center;
  font-size: 1.2rem;
  color: #666;
}

.cert-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.cert-date {
  font-size: 1.3rem;
  color: #444;
}

.cert-authority {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.authority-name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.3rem;
}

.cert-seal {
  width: 70px;
  height: 70px;
  border: 4px solid #ef4444;
  border-radius: 50%;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  transform: rotate(-10deg);
}

.cert-code {
  position: absolute;
  top: 30px;
  right: 40px;
  font-size: 0.9rem;
  color: #999;
}

/* 인쇄 최적화 */
@media print {

  /* 인쇄 시 불필요한 모든 요소 숨기기 */
  header,
  .no-print,
  .viewer-mode>div:not(:last-child),
  h3,
  .btn,
  .cert-actions {
    display: none !important;
  }

  /* 인쇄 시 레이아웃 초기화 (계층 구조 유지) */
  html,
  body,
  main,
  #quizContainer,
  .results-view,
  #inlineCertContainer {
    display: block !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: white !important;
    box-shadow: none !important;
    transform: none !important;
  }

  .certificate-printable {
    display: block !important;
    visibility: visible !important;
    margin: 0 auto !important;
    width: 210mm !important;
    height: 297mm !important;
    box-sizing: border-box !important;
    page-break-after: avoid;
    page-break-before: avoid;
    border: none !important;
  }

  .cert-border-outer {
    border: 6px solid #c5a368 !important;
    /* 인쇄 시 테두리 두께 강조 */
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }
}

/* 힌트 박스 스타일: 문제 바 아래에 절대 위치로 표시 */
.hint-text-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #fffbeb;
  border-bottom: 2px solid #f59e0b;
  padding: 1rem 2.5rem;
  font-size: 1rem;
  color: #92400e;
  z-index: 50;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  animation: slideDown 200ms ease-out;
}

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

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

/* Password Demo Styles */
.password-demo-container {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 1rem;
  margin-bottom: 2rem;
  border: 1px solid #e2e8f0;
  text-align: center;
  animation: fadeIn 0.5s ease-out;
}

.demo-label {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 1rem;
  font-weight: 600;
}

.password-input-mock {
  display: inline-flex;
  align-items: center;
  background: white;
  border: 2px solid #cbd5e0;
  border-radius: 0.75rem;
  padding: 0.6rem 1.2rem;
  width: 260px;
  justify-content: space-between;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s;
}

.password-input-mock:hover {
  border-color: #3b82f6;
}

#passText {
  font-family: 'Courier New', monospace;
  font-size: 1.6rem;
  letter-spacing: 0.3rem;
  color: #000;
  font-weight: bold;
}

.pass-eye-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.1s;
}

.pass-eye-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.pass-eye-btn:active {
  transform: scale(0.9);
}

.demo-hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #94a3b8;
  font-style: italic;
}

.dark-mode .password-demo-container {
  background: #1e293b;
  border-color: #334155;
}

.dark-mode .password-input-mock {
  background: #0f172a;
  border-color: #334155;
}

.dark-mode #passText {
  color: #f1f5f9;
}

/* --- Ad Banner Styles --- */
.ad-banner-placeholder {
  background: #f1f5f9;
  border-top: 1px solid var(--glass-border);
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  width: 100%;
}

.ad-label {
  font-size: 0.65rem;
  color: #94a3b8;
  letter-spacing: 0.1em;
  margin-bottom: 0.2rem;
  font-weight: 600;
}

.ad-slot {
  width: 100%;
  max-width: 728px;
  height: 60px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px dashed #cbd5e0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.ad-text {
  color: #94a3b8;
  font-size: 0.8rem;
  font-style: italic;
}

.dark-mode .ad-banner-placeholder {
  background: #0f172a;
  border-top-color: rgba(255, 255, 255, 0.05);
}

.dark-mode .ad-slot {
  background: rgba(255, 255, 255, 0.02);
  border-color: #334155;
}

/* --- Mobile Responsive Adjustments for Results --- */
@media (max-width: 640px) {
  .results-view .no-print {
    flex-direction: column !important;
    padding: 1.5rem !important;
    gap: 1.5rem !important;
    text-align: center;
  }

  .results-view .no-print>div {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .cert-input-row {
    flex-wrap: wrap !important;
  }

  .cert-input-row input {
    flex: 1 1 100% !important;
    min-width: 0;
  }

  .breakdown-card {
    padding: 1rem !important;
  }

  .result-actions-top {
    flex-direction: column !important;
  }
}

@media (max-width: 640px) {
  .result-main-card {
    flex-direction: column !important;
    padding: 1.5rem !important;
    gap: 1.5rem !important;
    text-align: center;
  }
}

/* Short Answer & Image Styling */
.short-answer-container {
  animation: fadeIn 0.5s ease;
}

#shortAnswerInput:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.question-image-container img {
  border: 3px solid white;
  box-shadow: var(--shadow-deep);
  transition: transform 0.3s ease;
}

.question-image-container img:hover {
  transform: scale(1.02);
}

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

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