/* 라이트 테마와 다크 테마를 위한 CSS 변수 */
:root {
	/* 라이트 테마 기본값 */
	--bg-color: #e8f5e9;
	--text-color: #2e7d32;
	--container-bg: #f1f8e9;
	--border-color: #aed581;
	--option-bg: #dcedc8;
	--option-hover: #c5e1a5;
	--button-bg: #aed581;
	--button-color: #33691e;
	--topbar-bg: rgba(241, 248, 233, 0.95);
	--skeleton-gradient: linear-gradient(
		90deg,
		#dcedc8 25%,
		#e8f5e9 50%,
		#dcedc8 75%
	);
}

/* 다크 테마 */
[data-theme="dark"] {
	--bg-color: #1a1a1a;
	--text-color: #a5d6a7;
	--container-bg: #2d2d2d;
	--border-color: #4caf50;
	--option-bg: #3d3d3d;
	--option-hover: #4a4a4a;
	--button-bg: #4caf50;
	--button-color: #e8f5e9;
	--topbar-bg: rgba(45, 45, 45, 0.95);
	--skeleton-gradient: linear-gradient(
		90deg,
		#3d3d3d 25%,
		#2d2d2d 50%,
		#3d3d3d 75%
	);
}

/* 전체 페이지 스타일 */
body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	margin: 0;
	background: var(--main-bg);
	color: var(--text-color);
	font-family: "Pretendard Variable", -apple-system, BlinkMacSystemFont,
		system-ui, Roboto, sans-serif;
}

/* 메인 컨텐츠 영역 */
main {
	flex: 1;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	min-height: calc(100vh - 120px);
	background-image: var(--main-bg);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	background-attachment: fixed; /* 스크롤 시 배경 고정 */
}

/* 컨테이너: 모바일 화면 중앙 정렬 */
#quiz-container,
#result {
	max-width: 430px;
	width: calc(100% - 32px);
	margin: 20px auto;
	padding: 24px 16px;
	background: var(--container-bg);
	border: 2px solid var(--border-color);
	border-radius: 10px;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
	text-align: center;
	box-sizing: border-box;
}

/* 질문 텍스트 */
.question {
	font-size: 18px;
	margin-bottom: 20px;
	text-align: left;
	line-height: 1.5;
}

/* 질문 이미지 컨테이너 */
.question-image {
	width: 100%;
	aspect-ratio: 4 / 3; /* 4:3 비율 유지 */
	margin: 20px 0;
	background-color: var(--option-bg);
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
}

.question-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 8px;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.question-image img.loaded {
	opacity: 1;
}

/* 보기 버튼 */
.option {
	display: block;
	margin: 10px 0;
	padding: 16px;
	background: var(--option-bg);
	border: none;
	border-radius: 5px;
	cursor: pointer;
	font-size: 16px;
	width: 100%;
	text-align: left;
	color: var(--text-color);
	opacity: 1;
	transition: all 0.3s ease;
}
.option:hover {
	background: var(--option-hover);
	transform: translateX(5px);
}

/* 결과 창 */
#result {
	display: none;
	max-width: 430px;
	width: calc(100% - 32px);
	margin: 20px auto;
	padding: 24px 16px;
	background: var(--container-bg);
	border: 2px solid var(--border-color);
	border-radius: 10px;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
	box-sizing: border-box;
}

.result-title {
	font-size: 24px;
	color: var(--text-color);
	margin-bottom: 20px;
	text-align: center;
}

/* 결과 이미지 컨테이너 */
.result-image {
	width: 100%;
	aspect-ratio: 3 / 4; /* 3:4 비율로 유지 */
	margin: 20px 0;
	background-color: var(--option-bg);
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
}

.result-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 8px;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.result-image img.loaded {
	opacity: 1;
}

.result-button {
	display: block;
	width: 100%;
	padding: 16px;
	background: var(--button-bg);
	color: var(--button-color);
	border: none;
	border-radius: 5px;
	font-size: 16px;
	cursor: pointer;
	transition: background 0.3s ease;
}

.result-button:hover {
	background: var(--option-hover);
}

.share-button {
	margin-top: 8px;
	background: #81c784; /* 약간 다른 녹색 계열로 구분 */
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.share-button:hover {
	background: #a5d6a7;
}

.share-button::before {
	content: "📱";
	font-size: 16px;
}

/* 시작 화면 스타일 */
#start-container {
	width: 100%;
	min-height: calc(100vh - 40px - 80px); /* 헤더와 푸터 높이를 제외한 높이 */
	background-image: url("background.webp"); /* 배경 이미지 추가 */
	background-size: cover;
	background-position: center;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: center;
	padding: 40px 20px;
	box-sizing: border-box;
}

/* 제목 컨테이너 스타일 */
.title-container {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 40px;
}

/* 제목 스타일 수정 */
.title {
	font-size: 32px;
	font-weight: bold;
	color: #fff;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
	margin: 0; /* 기존 margin-top 제거 */
}

.start-button {
	background: var(--button-bg);
	color: var(--button-color);
	border: none;
	padding: 15px 40px;
	font-size: 20px;
	border-radius: 25px;
	cursor: pointer;
	margin-bottom: 40px;
	transition: background 0.3s ease;
}

.start-button:hover {
	background: var(--option-hover);
}

/* 탑바 스타일 수정 */
.topbar {
	position: static; /* fixed에서 static으로 변경 */
	height: 40px;
	background: var(--topbar-bg);
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 16px;
	border-bottom: 1px solid var(--border-color);
}

.language-switcher {
	display: flex;
	gap: 8px;
	font-size: 14px;
	color: var(--text-color);
}

.language-btn {
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: var(--text-color);
	opacity: 0.5;
	font-size: 14px;
}

.language-btn.active {
	opacity: 1;
	font-weight: bold;
}

/* 점수 표시 스타일 추가 */
.score-text {
	font-size: 14px;
	color: var(--text-color);
	text-align: center;
	margin-bottom: 12px;
	opacity: 0.8;
}

/* 스켈레톤 로딩 애니메이션 스타일 추가 */
@keyframes shimmer {
	0% {
		background-position: -200% 0;
	}
	100% {
		background-position: 200% 0;
	}
}

.skeleton {
	background: var(--skeleton-gradient);
	background-size: 200% 100%;
	animation: shimmer 1.5s infinite;
}

.topbar-left {
	display: flex;
	align-items: center;
	gap: 4px;
}

.music-guide {
	font-size: 12px;
	color: var(--text-color);
	opacity: 0.8;
}

.music-button {
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	font-size: 14px;
	color: var(--text-color);
	transition: transform 0.2s ease;
}

.music-button:hover {
	transform: scale(1.1);
}

/* 이미지 출처 스타일 추가 */
.image-credit {
	font-size: 10px;
	color: var(--text-color);
	opacity: 0.6;
	text-align: right;
	margin-top: 4px;
	font-style: italic;
}

.image-credit a {
	color: inherit;
	text-decoration: none;
}

.image-credit a:hover {
	text-decoration: underline;
}

/* 푸터 스타일 수정 */
.footer {
	width: 100%;
	padding: 10px 0; /* 기존 패딩값을 줄임 */
	background: var(--topbar-bg);
	border-top: 1px solid var(--border-color);
	text-align: center;
	position: static; /* fixed에서 static으로 변경 */
	font-size: 12px;
	color: var(--text-color);
	box-sizing: border-box;
}

.footer-content {
	max-width: 430px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.footer-links {
	display: flex;
	justify-content: center;
	gap: 16px;
}

.footer a {
	color: var(--text-color);
	text-decoration: none;
	transition: opacity 0.3s ease;
}

.footer a:hover {
	opacity: 0.7;
}

/* 기존 컨테이너들의 하단 여백 수정 */
#quiz-container,
#result {
	margin-bottom: 20px; /* 80px에서 20px로 변경 */
}

#start-container {
	padding-bottom: 20px; /* 80px에서 20px로 변경 */
}

/* 테마 토글 버튼 추가 */
.theme-toggle {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 1.2em;
	padding: 0 5px;
	vertical-align: middle;
}

.theme-toggle:hover {
	opacity: 0.8;
}

.instagram-share {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.instagram-share i {
	font-size: 1.2em;
}

.share-buttons {
	display: flex;
	gap: 1rem;
	justify-content: center;
	margin-top: 1rem;
}

.icon-button {
	background: none;
	border: none;
	font-size: 1.5rem;
	cursor: pointer;
	padding: 0.5rem;
	border-radius: 50%;
	width: 3rem;
	height: 3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
}

.icon-button:hover {
	background-color: rgba(0, 0, 0, 0.1);
	transform: scale(1.1);
}

[data-theme="dark"] .icon-button:hover {
	background-color: rgba(255, 255, 255, 0.1);
}

/* 버튼 그룹 스타일 */
.button-group {
	display: flex;
	gap: 10px;
	margin-top: 20px;
}

.button-group .result-button {
	flex: 1;
	margin: 0;
}

/* 다시 시작하기 버튼 스타일 */
.button-group .result-button:first-child {
	background: var(--button-bg);
	color: var(--button-color);
}

.button-group .result-button:first-child:hover {
	background: var(--option-hover);
}

/* 공유하기 버튼 스타일 */
.button-group .result-button:last-child {
	background: #81c784; /* 녹색 계열 */
	color: white;
}

.button-group .result-button:last-child:hover {
	background: #66bb6a; /* 호버 시 약간 더 진한 녹색 */
}

/* 모달 스타일 */
.modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	justify-content: center;
	align-items: center;
	z-index: 1000;
}

.modal-content {
	background: var(--container-bg);
	padding: 24px;
	border-radius: 10px;
	width: 90%;
	max-width: 320px;
	max-height: 80vh; /* 화면 높이의 80%로 제한 */
	text-align: center;
	position: relative;
	display: flex;
	flex-direction: column;
}

.modal-content h3 {
	margin: 0 0 20px 0;
	color: var(--text-color);
	font-size: 1.2em;
	position: sticky;
	top: 0;
	background: var(--container-bg);
}

.share-buttons {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin-bottom: 20px;
	justify-content: center;
}

.share-buttons .icon-button {
	aspect-ratio: 1;
	padding: 0;
	border: none;
	border-radius: 12px;
	background: var(--option-bg);
	color: var(--text-color);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	margin: 0 auto;
	width: 100%;
}

.share-buttons .icon-button i {
	font-size: 1.5em;
}

.share-buttons .icon-button:hover {
	background: var(--option-hover);
	transform: translateY(-3px);
}

.modal-close {
	margin-top: 20px;
	position: sticky;
	bottom: 0;
	background: var(--button-bg);
	width: auto;
	padding: 12px 32px;
	border: none;
	border-radius: 8px;
	color: var(--button-color);
	cursor: pointer;
	transition: all 0.3s ease;
	font-size: 1em;
}

.modal-close:hover {
	background: var(--option-hover);
	transform: translateY(-2px);
}

/* 정보 버튼 스타일 */
.info-button {
	background: none;
	border: none;
	font-size: 24px; /* 크기 키움 */
	color: #fff; /* 흰색으로 변경 */
	cursor: pointer;
	padding: 4px;
	opacity: 0.9;
	transition: all 0.3s ease;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); /* 제목과 동일한 그림자 효과 */
}

.info-button:hover {
	opacity: 1;
	transform: scale(1.1);
}

/* 정보 모달 내용 스타일 */
.info-text {
	text-align: left;
	line-height: 1.6;
	color: var(--text-color);
	margin: 20px 0;
	overflow-y: auto; /* 세로 스크롤 추가 */
	padding-right: 10px; /* 스크롤바 공간 확보 */
	flex: 1; /* 남은 공간 모두 차지 */
}

.info-text p {
	margin: 12px 0;
}

.contact-email {
	text-align: center;
	font-weight: bold;
	margin-top: 20px;
}

/* 스크롤바 스타일링 */
.info-text::-webkit-scrollbar {
	width: 8px;
}

.info-text::-webkit-scrollbar-track {
	background: var(--container-bg);
	border-radius: 4px;
}

.info-text::-webkit-scrollbar-thumb {
	background: var(--border-color);
	border-radius: 4px;
}

.info-text::-webkit-scrollbar-thumb:hover {
	background: var(--button-bg);
}

/* 프로그레스 바 컨테이너 */
.progress-bar-container {
	width: 100%;
	padding: 10px 0;
	margin-bottom: 20px;
}

/* 프로그레스 바 */
.progress-bar {
	height: 4px;
	background: var(--button-bg);
	transition: width 0.3s ease;
	margin: 0 auto;
	border-radius: 2px;
}

/* 진행 상황 텍스트 */
.progress-text {
	text-align: center;
	color: var(--text-color);
	font-size: 14px;
	margin-top: 5px;
}

/* 질문 컨테이너 여백 조정 */
#quiz-container {
	padding-top: 0;
}
