@font-face {
  font-family: 'DungGeunMo';
  src: url('./fonts/DungGeunMo WebFont/DungGeunMo.eot');
  src: url('./fonts/DungGeunMo WebFont/DungGeunMo.eot?#iefix') format('embedded-opentype'),
       url('./fonts/DungGeunMo WebFont/DungGeunMo.woff2') format('woff2'),
       url('./fonts/DungGeunMo WebFont/DungGeunMo.woff') format('woff');
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'DungGeunMo', 'Press Start 2P', 'Courier New', monospace;
  overflow: hidden;
}

#title {
  font-family: 'DungGeunMo', cursive;
  color: #f0d060;
  font-size: clamp(12px, 3vw, 20px);
  text-align: center;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 #8b6914, 0 0 10px rgba(240, 208, 96, 0.3);
  letter-spacing: 1px;
  padding: 0 12px;
}

#music-toggle {
  position: absolute;
  top: 32px;
  right: 6px;
  z-index: 5;
  font-family: 'DungGeunMo', 'Press Start 2P', cursive;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 6px 10px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#music-toggle:hover {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}

#lang-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 5;
  font-family: 'DungGeunMo', 'Press Start 2P', cursive;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 6px 10px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#lang-toggle:hover {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}

#time-info {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 5;
  font-family: 'DungGeunMo', 'Press Start 2P', cursive;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 6px 10px;
  line-height: 1;
  display: none;
}

#weather-info {
  position: absolute;
  top: 32px;
  left: 6px;
  z-index: 5;
  font-family: 'DungGeunMo', 'Press Start 2P', cursive;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 6px 10px;
  line-height: 1;
  display: none;
}

#game-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 4 / 3;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  border: 2px solid #4a4a6a;
  border-radius: 8px;
  image-rendering: pixelated;
  touch-action: none;
}

.dialog {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  width: min(90vw, 460px);
  background: rgba(10, 10, 30, 0.95);
  border: 2px solid #f0d060;
  border-radius: 10px;
  padding: 14px 18px 12px;
  color: #fff;
  z-index: 10;
}

.dialog.hidden {
  display: none;
}

.dialog-name {
  font-size: 14px;
  font-weight: bold;
  color: #f0d060;
  margin-bottom: 6px;
}

.dialog-text {
  font-size: 13px;
  line-height: 1.5;
  min-height: 40px;
}

.dialog-text a {
  color: #6cb8ff;
  text-decoration: underline;
  pointer-events: auto;
  -webkit-user-select: auto;
  user-select: auto;
}

.dialog-hint {
  text-align: right;
  font-size: 11px;
  color: #888;
  margin-top: 6px;
  animation: blink 1.2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* 시작 오버레이 */
#start-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 30, 0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#start-overlay.hidden {
  display: none;
}

#start-text {
  font-family: 'DungGeunMo', 'Press Start 2P', cursive;
  color: #f0d060;
  font-size: clamp(16px, 5vw, 28px);
  text-shadow: 2px 2px 0 #8b6914, 0 0 20px rgba(240, 208, 96, 0.4);
  animation: blink 1.2s infinite;
  letter-spacing: 2px;
}

/* 터치 컨트롤 (모바일) */
#touch-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  z-index: 20;
  pointer-events: none;
}

#joystick-zone {
  position: absolute;
  bottom: 10px;
  left: 24px;
  width: 120px;
  height: 120px;
  pointer-events: auto;
  touch-action: none;
}

#joystick-base {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.2);
  position: relative;
}

#joystick-knob {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: none;
}

.action-btn {
  position: absolute;
  bottom: 30px;
  right: 32px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  pointer-events: auto;
}

.action-btn:active {
  background: rgba(255, 255, 255, 0.3);
}

#instructions {
  margin-top: 8px;
  color: #8888aa;
  font-size: 12px;
}

#footer-links {
  display: flex;
  gap: 24px;
  margin-top: 10px;
  padding: 8px 16px;
  font-size: 12px;
  color: #8888aa;
}

.footer-person {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-person a {
  color: #6cb8ff;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-person a:hover {
  color: #a0d4ff;
  text-decoration: underline;
}

/* 모바일 대응 */
@media (max-width: 600px) {
  #title {
    font-size: clamp(14px, 4vw, 20px);
    margin-bottom: 4px;
  }

  #game-wrapper {
    max-width: 100vw;
    border-radius: 0;
  }

  #game {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  #touch-controls {
    display: block;
  }

  #instructions {
    display: none;
  }

  .dialog {
    bottom: 200px;
    padding: 12px 14px 10px;
  }

  .dialog-text {
    font-size: 12px;
    line-height: 1.6;
  }

  .dialog-text a {
    display: inline-block;
    padding: 4px 0;
    font-size: 13px;
  }

  #weather-info,
  #lang-toggle,
  #music-toggle {
    font-size: 10px;
    padding: 5px 8px;
  }

  #time-info {
    font-size: 10px;
    padding: 5px 8px;
  }

}

@media (hover: none) and (pointer: coarse) {
  #touch-controls {
    display: block;
  }

  #instructions {
    display: none;
  }

  .dialog-text a {
    display: inline-block;
    padding: 4px 0;
  }
}
