:root {
  --paper: #f5f0e6;
  --paper-dark: #e8e0d0;
  --ink: #2c2c2c;
  --ink-light: #5a5a5a;
  --accent: #c41e3a;
  --accent-soft: rgba(196, 30, 58, 0.15);
  --indigo: #3d5a80;
  --indigo-soft: rgba(61, 90, 128, 0.12);
  --correct: #2d6a4f;
  --wrong: #9d0208;
  --shadow: rgba(44, 44, 44, 0.08);
  --radius: 12px;
}

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

body {
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow-x: hidden;
}

.bg-pattern {
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(circle at 20% 80%, var(--indigo-soft) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, var(--accent-soft) 0%, transparent 35%);
  pointer-events: none;
  z-index: 0;
}

.quiz-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px var(--shadow);
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

/* 고양이 캐릭터 - 퀴즈 우측 상단 */
.quiz-cat {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 56px;
  height: 56px;
}

.cat-face {
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #ffd89b 0%, #f5c882 100%);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 -2px 4px rgba(255, 255, 255, 0.5);
  transition: transform 0.25s ease;
}

.cat-ears {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 20px;
  pointer-events: none;
}

.cat-ear {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent transparent #f5c882 transparent;
  border-width: 0 10px 18px 10px;
  top: 2px;
}

.cat-ear.ear-l {
  left: -4px;
  transform: rotate(-25deg);
}

.cat-ear.ear-r {
  right: -4px;
  left: auto;
  transform: rotate(25deg);
}

.cat-eyes {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.cat-eye {
  width: 8px;
  height: 8px;
  background: #2c2c2c;
  border-radius: 50%;
  transition: transform 0.25s ease, height 0.25s ease, border-radius 0.25s ease;
}

/* 기본(대기) - 살짝 웃는 눈 */
.quiz-cat .cat-eye {
  transform: scaleY(0.85);
}

/* 정답 - 웃는 표정 */
.quiz-cat.happy .cat-eye {
  transform: scaleY(0.4) scaleX(1.2);
  height: 4px;
  border-radius: 50%;
  background: #2c2c2c;
}

.quiz-cat.happy .cat-mouth {
  border-radius: 0 0 50% 50%;
  border: 2px solid #2c2c2c;
  border-top: none;
  height: 6px;
  width: 14px;
  margin-top: 2px;
}

/* 오답 - 슬픈 표정 */
.quiz-cat.sad .cat-eye {
  transform: rotate(180deg) scaleY(0.5);
  height: 5px;
  border-radius: 50% 50% 0 0;
}

.quiz-cat.sad .cat-mouth {
  border-radius: 50% 50% 0 0;
  border: 2px solid #2c2c2c;
  border-bottom: none;
  height: 6px;
  width: 14px;
  margin-top: 4px;
}

.cat-mouth {
  position: absolute;
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 4px;
  border-radius: 0 0 50% 50%;
  border: 2px solid #2c2c2c;
  border-top: none;
  transition: border-radius 0.25s ease, height 0.25s ease, margin 0.25s ease;
}

.quiz-cat.happy .cat-face,
.quiz-cat.sad .cat-face {
  transition: transform 0.2s ease;
}

.quiz-cat.happy .cat-face {
  transform: scale(1.05);
}

.quiz-cat.sad .cat-face {
  transform: scale(0.98);
}

.quiz-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.quiz-header h1 {
  font-family: 'Zen Kaku Gothic New', 'Noto Sans KR', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.quiz-header .subtitle {
  font-size: 0.9rem;
  color: var(--ink-light);
  margin-top: 0.25rem;
}

.score-board {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--ink-light);
}

.score-value {
  font-weight: 700;
  color: var(--indigo);
}

.score-separator {
  margin: 0 0.2rem;
}

/* Screens */
.screen {
  display: none;
  animation: fadeIn 0.35s ease;
}

.screen.active {
  display: block;
}

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

/* Start screen */
#start-screen {
  text-align: center;
  padding: 1rem 0;
}

.intro-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-light);
  margin-bottom: 2rem;
}

.btn {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.9rem 2rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow);
}

.btn:active {
  transform: translateY(0);
}

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

.btn-primary:hover {
  background: #a0182e;
}

.btn-secondary {
  background: var(--paper-dark);
  color: var(--ink);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
  background: var(--ink-light);
  color: white;
}

/* 연락하기 버튼 */
.contact-open-btn {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  background: var(--indigo);
  color: white;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.contact-open-btn:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow);
}

/* 연락하기 모달 */
.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.contact-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.contact-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.contact-modal-box {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px var(--shadow);
  padding: 1.75rem;
}

.contact-modal-title {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  color: var(--ink);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--ink-light);
}

.contact-input {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--paper-dark);
  border-radius: 8px;
  color: var(--ink);
  transition: border-color 0.2s;
}

.contact-input:focus {
  outline: none;
  border-color: var(--indigo);
}

.contact-form-msg {
  font-size: 0.9rem;
  min-height: 1.25rem;
}

.contact-form-msg.success {
  color: var(--correct);
}

.contact-form-msg.error {
  color: var(--wrong);
}

.contact-form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

/* Quiz screen */
.question-card {
  background: var(--paper-dark);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.question-number {
  font-size: 0.8rem;
  color: var(--ink-light);
  margin-bottom: 0.5rem;
}

.japanese-word {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.reading {
  font-size: 1rem;
  color: var(--indigo);
  font-weight: 500;
}

.prompt {
  font-size: 0.9rem;
  color: var(--ink-light);
  margin-bottom: 1rem;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-btn {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1rem;
  padding: 1rem 1.25rem;
  background: white;
  border: 2px solid var(--paper-dark);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--indigo);
  background: var(--indigo-soft);
}

.option-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.option-btn.correct {
  border-color: var(--correct);
  background: rgba(45, 106, 79, 0.12);
  color: var(--correct);
}

.option-btn.wrong {
  border-color: var(--wrong);
  background: rgba(157, 2, 8, 0.08);
  color: var(--wrong);
}

.feedback {
  margin-top: 1rem;
  min-height: 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.feedback.correct-msg {
  color: var(--correct);
}

.feedback.wrong-msg {
  color: var(--wrong);
}

/* Result screen */
#result-screen {
  text-align: center;
  padding: 0.5rem 0;
}

.result-card {
  padding: 0.5rem 0;
}

.result-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--ink);
}

.result-score {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--indigo);
  margin-bottom: 0.5rem;
}

.result-message {
  font-size: 1rem;
  color: var(--ink-light);
  margin-bottom: 2rem;
  line-height: 1.5;
}

#retry-btn {
  margin-top: 0.5rem;
}
