/* ============================================
   THE TAPPER'S APPRENTICE — Visual Novel Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=Nunito:wght@400;600;700&display=swap');

/* === Reset & Base === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --palm-green: #3a5a2e;
  --earth-brown: #7a4f2c;
  --warm-cream: #f5e8d0;
  --gold-accent: #c8972b;
  --deep-red: #8b2e2e;
  --text-dark: #2a1a0e;
  --text-light: #f5e8d0;
  --ui-bg: rgba(20, 14, 8, 0.85);
  --ui-border: rgba(200, 151, 43, 0.4);
}

body {
  font-family: 'Nunito', sans-serif;
  background: #111;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* === Background === */
#background-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.8s ease;
}

/* Placeholder backgrounds using CSS gradients */
.bg-village-morning {
  background: linear-gradient(to bottom, #1a3a5c 0%, #e8a87c 40%, #f5e8d0 60%, #c8d5a0 100%);
}

.bg-palm-grove {
  background: linear-gradient(to bottom, #0d2b0d 0%, #1a4a1a 30%, #3a6a2e 60%, #c8d5a0 100%);
}

.bg-market {
  background: linear-gradient(to bottom, #8b4513 0%, #cd853f 40%, #daa06d 70%, #f5e8d0 100%);
}

.bg-night-sky {
  background: linear-gradient(to bottom, #0a0a2e 0%, #1a1a4e 40%, #2a1a4e 100%);
}

.bg-palm-close {
  background: linear-gradient(to bottom, #2d5016 0%, #3a6a2e 30%, #6a9a4e 70%, #a8c890 100%);
}

.bg-competition {
  background: linear-gradient(to bottom, #d4a017 0%, #f0c040 30%, #f5e8d0 60%, #e8d090 100%);
}

/* === Character Layer === */
#character-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* === Name Box === */
#name-box {
  position: absolute;
  bottom: 228px;
  left: 80px;
  background: var(--ui-bg);
  border: 2px solid var(--gold-accent);
  border-radius: 6px;
  padding: 6px 20px;
  min-width: 140px;
  text-align: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
  z-index: 20;
}

#name-box.hidden {
  opacity: 0;
  pointer-events: none;
}

#speaker-name {
  font-family: 'Lora', serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--gold-accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* === Dialogue Box === */
#dialogue-box {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 220px;
  background: linear-gradient(to bottom, rgba(20, 14, 8, 0.0) 0%, rgba(20, 14, 8, 0.95) 20%, rgba(20, 14, 8, 0.99) 100%);
  padding: 20px 120px 50px 120px;
  cursor: pointer;
  transition: opacity 0.3s ease;
  border-top: 1px solid var(--ui-border);
}

#dialogue-box.hidden {
  opacity: 0;
  pointer-events: none;
}

#dialogue-text {
  font-family: 'Lora', serif;
  font-size: 1.2rem;
  line-height: 1.85;
  color: var(--warm-cream);
  max-width: 900px;
  margin: 0 auto;
  min-height: 4.2em;
}

#continue-hint {
  position: absolute;
  right: 100px;
  bottom: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.75rem;
  color: rgba(200, 151, 43, 0.6);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#continue-indicator {
  position: absolute;
  right: 100px;
  bottom: 30px;
  font-size: 1rem;
  color: var(--gold-accent);
  animation: bounce 1.2s ease-in-out infinite;
  opacity: 0.7;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(4px); opacity: 1; }
}

/* === Choices Panel === */
#choices-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 0.3s ease;
}

#choices-panel.hidden {
  opacity: 0;
  pointer-events: none;
}

.choice-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--warm-cream);
  background: var(--ui-bg);
  border: 2px solid var(--ui-border);
  border-radius: 6px;
  padding: 14px 40px;
  min-width: 360px;
  max-width: 600px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.choice-btn:hover {
  background: rgba(200, 151, 43, 0.25);
  border-color: var(--gold-accent);
  transform: translateY(-2px);
}

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

/* === Title Screen === */
#title-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d1a0d 0%, #1a3a0d 30%, #2a4a1a 60%, #0d1a0d 100%);
  z-index: 100;
  transition: opacity 0.8s ease;
}

#title-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.title-content {
  text-align: center;
  animation: fadeInUp 1s ease;
}

.title-content h1 {
  font-family: 'Lora', serif;
  font-size: 3.2rem;
  font-weight: 600;
  color: var(--gold-accent);
  margin-bottom: 10px;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 20px rgba(200, 151, 43, 0.4);
}

.title-content p {
  font-family: 'Nunito', sans-serif;
  font-size: 1.1rem;
  color: var(--warm-cream);
  opacity: 0.7;
  margin-bottom: 50px;
  font-style: italic;
}

#start-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  background: var(--gold-accent);
  border: none;
  border-radius: 6px;
  padding: 16px 60px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#start-btn:hover {
  background: #e0b030;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(200, 151, 43, 0.4);
}

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

/* === Fade Transitions === */
.fade-out {
  opacity: 0 !important;
  transition: opacity 0.8s ease !important;
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
  .title-content h1 {
    font-size: 2rem;
    padding: 0 20px;
  }

  #dialogue-box {
    padding: 20px 30px 20px 30px;
  }

  #name-box {
    left: 30px;
  }

  #dialogue-text {
    font-size: 1rem;
  }

  .choice-btn {
    min-width: 280px;
    font-size: 1rem;
    padding: 12px 24px;
  }

  #character-layer {
    padding-bottom: 240px;
  }

  .character-sprite {
    max-height: 50vh;
  }
}
