/* 기본 리셋 및 전역 스타일 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-size: 16px; /* 기본 폰트 크기 명시 */
  -webkit-text-size-adjust: 100%; /* iOS Safari 텍스트 크기 조정 방지 */
  -ms-text-size-adjust: 100%;
}

body {
  font-family: "Arial", sans-serif;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  color: white;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 헤더 스타일 */
.site-header {
  background: rgba(0, 0, 0, 0.9);
  padding: 15px 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 255, 136, 0.3);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  color: #00ff88;
  text-decoration: none;
}

.logo-text {
  font-size: 24px;
  font-weight: bold;
  color: #00ff88;
  text-decoration: none;
}

.nav-menu {
  display: flex;
  gap: 30px;
  align-items: center;
}

.nav-item {
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(0, 255, 136, 0.2);
  color: #00ff88;
}

.language-selector {
  display: flex;
  gap: 10px;
  align-items: center;
}
/*
.header-container .language-selector {
  display: none !important;
}
  */

/* 페이지 분리 */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* 홈 페이지 스타일 */
.hero-banner {
  height: 300px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    45deg,
    rgba(0, 255, 136, 0.1),
    rgba(0, 100, 255, 0.1)
  );
  border-bottom: 1px solid rgba(0, 255, 136, 0.3);
}

.banner-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  background: linear-gradient(
    135deg,
    rgba(26, 26, 46, 0.8),
    rgba(15, 52, 96, 0.8)
  );
}

.banner-slide.active {
  opacity: 1;
}

.banner-title {
  font-size: 48px;
  font-weight: bold;
  color: #00ff88;
  margin-bottom: 15px;
  text-align: center;
}

.banner-subtitle {
  font-size: 18px;
  color: #aaa;
  text-align: center;
  max-width: 600px;
}

.sitemap-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.sitemap-section {
  background: rgba(0, 0, 0, 0.6);
  border-radius: 15px;
  padding: 20px;
  border: 1px solid rgba(0, 255, 136, 0.2);
  transition: all 0.3s ease;
}

.sitemap-section:hover {
  border-color: rgba(0, 255, 136, 0.5);
  transform: translateY(-5px);
}

.sitemap-title {
  font-size: 24px;
  color: #00ff88;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sitemap-description {
  padding: 5px;
  line-height: 1.6;
  color: #aaa;
}

.sitemap-description strong {
  color: #00ff88;
  font-size: 14px;
}

.sitemap-description p {
  margin-bottom: 10px;
  font-size: 14px;
}

.sitemap-list {
  list-style: none;
}

.sitemap-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: color 0.3s ease;
}

.sitemap-item:hover {
  color: #00ff88;
}

.sitemap-item:last-child {
  border-bottom: none;
}

/* 사이드바 스타일 */
.sidebar {
  width: 250px;
  background: rgba(0, 0, 0, 0.8);
  padding: 20px;
  border-right: 1px solid rgba(0, 255, 136, 0.3);
}

.sidebar h3 {
  color: #00ff88;
  margin-bottom: 20px;
  font-size: 18px;
}

.game-list {
  list-style: none;
}

.game-item {
  padding: 12px 16px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.game-item:hover,
.game-item.active {
  background: rgba(0, 255, 136, 0.1);
  border-left-color: #00ff88;
}

/* 광고 영역 */

.ad-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 180px;
  order: 3 !important;
}

/*
.ad-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 180px;
}
  */

.ad-slot {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(0, 255, 136, 0.3);
  border-radius: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 450px;
}

.ad-placeholder {
  color: #666;
  font-size: 14px;
}

/* 소개 페이지 */
.about-container {
  display: flex;
  gap: 20px;
}

.about-content {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.about-card {
  background: rgba(0, 0, 0, 0.7);
  border-radius: 15px;
  padding: 40px;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.about-title {
  font-size: 32px;
  color: #00ff88;
  margin-bottom: 30px;
  text-align: center;
}

.about-policy .about-title {
  font-size: 25px;
  color: #ccc;
}

.about-policy strong {
  color: #ccc;
  font-size: 16px;
}

.about-policy p {
  font-size: 14px;
  color: #ccc;
  margin-bottom: 20px;
}

.about-policy p a {
  text-decoration: none;
  text-decoration-style: none;
  color: #ccc;
}

.about-policy p a:link {
  text-decoration: none;
  text-decoration-style: none;
  color: #ccc;
}

.about-policy p a:visited {
  text-decoration: none;
  text-decoration-style: none;
  color: #ccc;
}

.about-policy p a:hover {
  text-decoration: none;
  text-decoration-style: none;
  color: #ccc;
}

.about-policy p a:active {
  text-decoration: none;
  text-decoration-style: none;
  color: #ccc;
}

.about-card p {
  line-height: 1.8;
  margin: 20px 0;
  font-size: 16px;
}

.about-policy table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  border: 1px solid rgba(172, 172, 172, 0.8);
}

table th,
table td {
  border: 1px solid rgba(172, 172, 172, 0.8);
  padding: 2px 5px;
}

.about-info strong {
  color: #00ff88;
}

.about-box {
  margin-top: 40px;
  padding: 20px;
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 10px;
}

.about-box h3 {
  color: #00ff88;
  margin-bottom: 15px;
}

.about-box ul {
  list-style: none;
  padding: 0;
}

.about-box ul li {
  margin: 10px 0;
  padding: 10px;
  background: rgba(0, 255, 136, 0.1);
  border-radius: 5px;
}

.about-box div {
  margin: 15px 0;
  padding: 15px;
  background: rgba(0, 255, 136, 0.1);
  border-radius: 5px;
}

.about-btn {
  text-align: center;
  margin-top: 30px;
}

.about-btn a {
  display: inline-block;
  padding: 15px 30px;
  background: linear-gradient(45deg, #00ff88, #00cc6a);
  color: #1a1a2e;
  text-decoration: none;
  border-radius: 25px;
  font-weight: bold;
  margin: 10px;
}

/* 푸터 */
.footer-info {
  background: rgba(0, 0, 0, 0.9);
  padding: 30px 20px;
  border-top: 1px solid rgba(0, 255, 136, 0.3);
}

.footer-section {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-title {
  font-size: 20px;
  color: #00ff88;
  margin-bottom: 15px;
}

.footer-list {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

.footer-item {
  color: #aaa;
  cursor: pointer;
  transition: color 0.3s ease;
  padding: 5px 10px;
  border: none;
}

.footer-item:hover {
  color: #00ff88;
}

.footer-biz-info {
  margin-top: 20px;
  padding: 10px;
  border-top: 1px solid rgba(0, 255, 136, 0.3);
}

.footer-biz-item {
  color: #aaa;
  padding: 5px;
  font-size: 13px;
  line-height: 1.6;
}

.footer-biz-item a {
  text-decoration: none;
  text-decoration-style: none;
  color: #aaa;
}

.footer-biz-item a:link {
  text-decoration: none;
  text-decoration-style: none;
  color: #aaa;
}

.footer-biz-item a:visited {
  text-decoration: none;
  text-decoration-style: none;
  color: #aaa;
}

.footer-biz-item a:hover {
  text-decoration: underline;
  text-decoration-style: none;
  color: #aaa;
}

.footer-biz-item a:active {
  text-decoration: underline;
  text-decoration-style: none;
  color: #aaa;
}

/* 알림 */
.copy-notification {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 255, 136, 0.9);
  color: #1a1a2e;
  padding: 15px 25px;
  border-radius: 10px;
  font-weight: bold;
  z-index: 10000;
}

/* 공통 버튼 스타일 */
.tool-button {
  background: linear-gradient(45deg, #00ff88, #00cc6a);
  color: #1a1a2e;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  margin: 10px 5px 10px 0;
}

.tool-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 255, 136, 0.4);
}

.start-button {
  padding: 15px 40px;
  font-size: 20px;
  font-weight: bold;
  background: linear-gradient(45deg, #00ff88, #00cc6a);
  color: #1a1a2e;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 20px rgba(0, 255, 136, 0.3);
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 255, 136, 0.5);
}

.restart-button {
  padding: 12px 30px;
  font-size: 18px;
  font-weight: bold;
  background: linear-gradient(45deg, #00ff88, #00cc6a);
  color: #1a1a2e;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.restart-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 255, 136, 0.4);
}

/* 기존 main.css에 추가할 개선사항 */

/* ===== 반응형 기본 설정 강화 ===== */

/* ===== 향상된 터치 타겟 ===== */
button,
.nav-item,
.game-item,
.tool-button,
.start-button,
.restart-button,
.sitemap-item,
.footer-item,
.keyword-tag,
.memory-card,
.color-option {
  /* 최소 터치 영역 44px 보장 */
  min-height: 44px;
  min-width: 44px;

  /* 터치 피드백 개선 */
  -webkit-tap-highlight-color: rgba(0, 255, 136, 0.2);
  touch-action: manipulation;
}

/* ===== 향상된 포커스 관리 ===== */
button:focus,
input:focus,
select:focus,
textarea:focus,
.nav-item:focus,
.game-item:focus {
  outline: 2px solid #00ff88;
  outline-offset: 2px;
}

/* ===== 개선된 스크롤 동작 ===== */
html {
  scroll-behavior: smooth;
}

.ad-section {
  -webkit-overflow-scrolling: touch; /* iOS 부드러운 스크롤 */
}

.ad-sidebar {
  -webkit-overflow-scrolling: touch; /* iOS 부드러운 스크롤 */
}

/* ===== 향상된 레이아웃 유연성 ===== */
.main-container {
  display: flex;
  flex-direction: column;

  margin-top: 90px;
  min-height: calc(100vh - 70px);
}

.games-container,
.tools-container {
  display: flex;
  flex: 1;
  min-height: 0; /* Flexbox 오버플로우 방지 */
}

/* ===== 개선된 배너 슬라이드 ===== */
.hero-banner {
  position: relative;
  overflow: hidden;
  /* 터치 스와이프 지원을 위한 기반 준비 */
  touch-action: pan-x;
}

/* ===== 향상된 게임 영역 ===== */
.game-area {
  position: relative;
  overflow: hidden;
  touch-action: manipulation; /* 터치 조작 최적화 */
}

/* ===== 개선된 폼 요소 ===== */
input[type="number"],
input[type="text"],
select,
textarea {
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 136, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 12px;
  font-size: 16px; /* iOS 확대 방지 */
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #00ff88;
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1);
}

/* ===== 향상된 버튼 스타일 ===== */
.tool-button,
.start-button,
.restart-button {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;

  /* 터치 디바이스에서의 추가 패딩 */
  padding: 12px 24px;

  /* 버튼 내부 텍스트 선택 방지 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 버튼 활성화 효과 */
.tool-button:active,
.start-button:active,
.restart-button:active {
  transform: translateY(1px);
}

/* ===== 향상된 카드/컨테이너 ===== */
.sitemap-section,
.about-card,
.unit-converter-form {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sitemap-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 255, 136, 0.15);
}

/* ===== 개선된 애니메이션 ===== */
@keyframes pulse {
  0% {
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 68, 68, 1);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
    transform: scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 페이지 전환 애니메이션 */
.page {
  animation: fadeInUp 0.3s ease-out;
}

/* ===== 향상된 로딩 상태 ===== */
.loading {
  pointer-events: none;
  opacity: 0.7;
  cursor: wait;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #00ff88;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== 향상된 알림 시스템 ===== */
.copy-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;

  /* 모바일에서 더 큰 알림 */
  padding: 15px 25px;
  border-radius: 25px;
  font-size: 16px;

  /* 애니메이션 개선 */
  animation: slideInDown 0.3s ease-out, slideOutUp 0.3s ease-out 1.7s;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideOutUp {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

/* ===== 향상된 접근성 ===== */
/* 화면 리더기 전용 텍스트 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
  .nav-item,
  .game-item,
  .sitemap-item {
    border: 2px solid white;
  }

  .tool-button,
  .start-button,
  .restart-button {
    border: 2px solid #00ff88;
  }
}

/* ===== 다크모드 대응 ===== */
@media (prefers-color-scheme: dark) {
  /* 이미 다크 테마이므로 추가 조정 최소화 */
  .input-group input,
  .unit-group select,
  .input-section textarea {
    background: rgba(255, 255, 255, 0.05);
  }
}

/* ===== 인쇄 스타일 ===== */
@media print {
  .ad-sidebar,
  .ad-section,
  .game-area,
  .hero-banner {
    display: none;
  }

  .about-content,
  .sitemap-container {
    background: white;
    color: black;
  }
}

/* ===== 성능 최적화 ===== */
.target,
.memory-card,
.color-option,
.banner-slide {
  /* GPU 가속 활용 */
  will-change: transform;
  transform: translateZ(0);
}

/* 애니메이션 요소는 별도 레이어로 처리 */
.target {
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ===== 추가 유틸리티 클래스 ===== */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}

.d-flex {
  display: flex;
}
.d-block {
  display: block;
}
.d-none {
  display: none;
}

.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-around {
  justify-content: space-around;
}

.align-center {
  align-items: center;
}
.align-start {
  align-items: flex-start;
}
.align-end {
  align-items: flex-end;
}

.flex-column {
  flex-direction: column;
}
.flex-row {
  flex-direction: row;
}

.flex-wrap {
  flex-wrap: wrap;
}
.flex-nowrap {
  flex-wrap: nowrap;
}

/* 간격 유틸리티 */
.gap-xs {
  gap: 8px;
}
.gap-sm {
  gap: 12px;
}
.gap-md {
  gap: 16px;
}
.gap-lg {
  gap: 24px;
}
.gap-xl {
  gap: 32px;
}

.mt-xs {
  margin-top: 8px;
}
.mt-sm {
  margin-top: 12px;
}
.mt-md {
  margin-top: 16px;
}
.mt-lg {
  margin-top: 24px;
}
.mt-xl {
  margin-top: 32px;
}

.mb-xs {
  margin-bottom: 8px;
}
.mb-sm {
  margin-bottom: 12px;
}
.mb-md {
  margin-bottom: 16px;
}
.mb-lg {
  margin-bottom: 24px;
}
.mb-xl {
  margin-bottom: 32px;
}

.pt-xs {
  padding-top: 8px;
}
.pt-sm {
  padding-top: 12px;
}
.pt-md {
  padding-top: 16px;
}
.pt-lg {
  padding-top: 24px;
}
.pt-xl {
  padding-top: 32px;
}

.pb-xs {
  padding-bottom: 8px;
}
.pb-sm {
  padding-bottom: 12px;
}
.pb-md {
  padding-bottom: 16px;
}
.pb-lg {
  padding-bottom: 24px;
}
.pb-xl {
  padding-bottom: 32px;
}
