html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  min-height: 100dvh;
  min-width: 100dvw;
  background: #ffd062;
}

.center-wrapper {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  flex-direction: row;
  width: 90vw;
  max-width: 800px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.center-wrapper.ready {
  opacity: 1;
}

.janggu-image {
  user-select: none;
  width: 30vw;
  height: 30vw;
  min-width: 160px;
  min-height: 160px;
  max-width: 320px;
  max-height: 320px;
  object-fit: contain;
  object-position: center;
}

.click-area {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12vw;
  height: 12vw;
  min-width: 100px;
  min-height: 100px;
  max-width: 180px;
  max-height: 180px;
  background-color: white;
  border-radius: 50%;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  border: 0.9rem solid #ffb300;
  box-sizing: border-box;
}

.click-area:hover {
  background-color: rgb(255, 245, 227);
}

.click-area-text {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: bold;
  color: black;
  user-select: none;
  font-family: 'Nanum Myeongjo', 'Noto Serif KR', serif;
}

.note {
  position: fixed;
  font-size: 2rem;
  pointer-events: none;
  z-index: 1000;
  opacity: 1;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffd062;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: #333;
}

.loading-title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-family: 'Nanum Myeongjo', 'Noto Serif KR', serif;
  font-weight: bold;
  margin-bottom: 2rem;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255, 179, 0, 0.3);
  border-top-color: #ffb300;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

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

.loading-progress {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-family: 'Nanum Myeongjo', 'Noto Serif KR', serif;
  margin-top: 1rem;
}

.loading-bar-container {
  width: 300px;
  max-width: 80vw;
  height: 8px;
  background: rgba(255, 179, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem auto 0;
}

.loading-bar {
  height: 100%;
  background: #ffb300;
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 4px;
}

@media (max-width: 600px) {
  .center-wrapper {
    flex-direction: row;
    gap: 0.5rem;
    width: 98vw;
    max-width: none;
  }
  
  .janggu-image {
    width: 30vw;
    height: 30vw;
    min-width: 80px;
    min-height: 80px;
    max-width: 120px;
    max-height: 120px;
  }
  
  .click-area {
    width: 18vw;
    height: 18vw;
    min-width: 70px;
    min-height: 70px;
    max-width: 120px;
    max-height: 120px;
    border-width: 0.5rem;
  }
  
  .click-area-text {
    font-size: clamp(1.4rem, 7vw, 2.2rem);
  }
  
  .note {
    font-size: 1.3rem;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }
  
  .center-wrapper {
    flex-direction: row;
    gap: 2.5rem;
    width: auto;
    max-width: none;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    align-items: center;
    justify-content: center;
  }
  
  .janggu-image {
    width: 50vh;
    height: 50vh;
    min-width: 200px;
    min-height: 200px;
    max-width: 400px;
    max-height: 400px;
    order: 2;
    flex-shrink: 0;
  }
  
  .click-area {
    width: 20vh;
    height: 20vh;
    min-width: 90px;
    min-height: 90px;
    max-width: 160px;
    max-height: 160px;
    border-width: 0.8rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  #left-click-area {
    order: 1;
  }
  
  #right-click-area {
    order: 3;
  }
  
  .click-area-text {
    font-size: clamp(2rem, 5vh, 3.5rem);
  }
  
  .click-area:hover {
    background-color: rgb(255, 245, 227);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  }
  
  .click-area:active {
    transform: scale(0.95);
  }
}

@media (max-height: 450px) {
  .center-wrapper {
    position: static;
    top: unset;
    left: unset;
    transform: none;
    margin: 1.5rem auto;
    width: 100vw;
  }
}

