* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Nunito', system-ui, sans-serif;
  background: #0a1628;
  color: #fff;
}

.hidden { display: none !important; }

/* Screens */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0a1628 0%, #1a3a5c 50%, #2d5a3d 100%);
  z-index: 100;
  overflow-y: auto;
}

.menu-container {
  text-align: center;
  padding: 2rem;
  max-width: 520px;
  width: 90%;
}

.menu-container.small { max-width: 360px; }

.menu-logo,
.brand-logo {
  display: block;
  width: min(320px, 86vw);
  max-width: 360px;
  height: auto;
  max-height: 160px;
  object-fit: contain;
  object-position: center;
  margin: 0 auto 0.65rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.45));
}

.brand-logo-sm {
  width: min(180px, 55vw);
  max-width: 200px;
  max-height: 72px;
  margin-bottom: 0.4rem;
}

.brand-logo-lg {
  width: min(340px, 88vw);
  max-width: 380px;
  max-height: 180px;
}

.brand-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: #f0c14b;
  margin: 0 0 0.35rem;
}

@media (max-width: 600px) {
  .brand-logo-lg { max-height: 110px; }
  .brand-logo-sm { max-height: 56px; }
}

.brand {
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: #f0c14b;
  margin-bottom: 0.3rem;
}

.title {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
  margin-bottom: 0.2rem;
}

.subtitle {
  color: #a8d5a2;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.menu-btn {
  background: linear-gradient(180deg, #3a7d44 0%, #2a5c32 100%);
  border: 3px solid #f0c14b;
  color: #fff;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.85rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 0 #1a3a1e;
}

.menu-btn:hover, .menu-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #1a3a1e;
}

.menu-btn.primary {
  background: linear-gradient(180deg, #f0c14b 0%, #d4a017 100%);
  color: #1a2a1a;
  border-color: #fff;
  font-size: 1.3rem;
}

/* Loading */
#loading-screen {
  position: fixed;
  inset: 0;
  background: #0a1628;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.loader-content { text-align: center; }
.loader-content h1 { color: #f0c14b; font-size: 1.2rem; margin-bottom: 0.5rem; }
.loader-content h2 { font-size: 1.8rem; margin-bottom: 2rem; }

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #2a5c32;
  border-top-color: #f0c14b;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* Intro */
.intro-content {
  text-align: center;
  max-width: 600px;
  padding: 2rem;
}

.intro-kicker {
  font-size: 1.4rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.4rem;
}

.intro-title {
  font-size: 2.8rem;
  color: #f0c14b;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 30px rgba(240,193,75,0.5);
}

.intro-text {
  font-size: 1.25rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: #e0e8f0;
}

.intro-mission {
  font-size: 1.1rem;
  color: #a8d5a2;
  margin-bottom: 2rem;
}

/* Game Container */
#game-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #6ea8d4;
  z-index: 1;
}

#game-canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #6ea8d4;
}

/* HUD */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#hud-left {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(10, 22, 40, 0.75);
  border: 2px solid rgba(240, 193, 75, 0.5);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 200px;
}

.hud-name {
  font-weight: 800;
  font-size: 1.1rem;
  color: #f0c14b;
  margin-bottom: 6px;
}

.hud-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.hud-stat .icon { font-size: 1rem; }
.hud-stat .label { width: 42px; color: #a0b0c0; }

.bar-bg {
  flex: 1;
  height: 10px;
  background: #1a2a3a;
  border-radius: 5px;
  overflow: hidden;
  min-width: 70px;
}

.bar {
  height: 100%;
  border-radius: 5px;
  transition: width 0.25s ease;
}

.bar.life { background: linear-gradient(90deg, #e74c3c, #c0392b); width: 100%; }
.bar.armor { background: linear-gradient(90deg, #3498db, #2980b9); width: 100%; }
.bar.faith { background: linear-gradient(90deg, #f1c40f, #f39c12); width: 100%; }
.bar.boss { background: linear-gradient(90deg, #9b59b6, #8e44ad); width: 100%; }

#hud-right {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

#hud-world {
  background: rgba(10, 22, 40, 0.8);
  border: 2px solid rgba(240, 193, 75, 0.7);
  border-radius: 10px;
  padding: 4px 12px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #f0c14b;
}

#hud-world-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #e0e8f0;
  text-shadow: 0 1px 4px #000;
}

.score-box {
  background: rgba(10, 22, 40, 0.75);
  border: 2px solid rgba(240, 193, 75, 0.5);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #f0c14b;
}

.mute-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(240, 193, 75, 0.5);
  background: rgba(10, 22, 40, 0.8);
  font-size: 1.2rem;
  cursor: pointer;
  color: #fff;
}

#hud-mission {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 22, 40, 0.8);
  border: 2px solid rgba(168, 213, 162, 0.6);
  border-radius: 12px;
  padding: 10px 24px;
  text-align: center;
  max-width: 90%;
}

.mission-label {
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: #a8d5a2;
  margin-bottom: 2px;
}

#mission-text {
  font-size: 1rem;
  font-weight: 700;
}

#hud-message {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #f0c14b;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.3s;
}

#boss-hud {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(40, 10, 20, 0.85);
  border: 2px solid #9b59b6;
  border-radius: 12px;
  padding: 10px 20px;
  text-align: center;
  min-width: 280px;
}

.boss-name {
  font-weight: 800;
  color: #e74c3c;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.bar-bg.boss { height: 14px; margin: 4px 0; }

/* Mobile Controls */
#mobile-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
}

#joystick-zone {
  position: absolute;
  bottom: 30px;
  left: 20px;
  width: 140px;
  height: 140px;
  pointer-events: auto;
}

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

#joystick-stick {
  width: 50px;
  height: 50px;
  background: rgba(240, 193, 75, 0.85);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#action-buttons {
  position: absolute;
  bottom: 30px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

.action-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.5);
  background: rgba(42, 92, 50, 0.85);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.75rem;
  pointer-events: auto;
  touch-action: manipulation;
}

.action-btn.attack {
  background: rgba(192, 57, 43, 0.9);
  width: 80px;
  height: 80px;
  font-size: 0.85rem;
}

.action-btn.special {
  background: rgba(241, 196, 15, 0.9);
  color: #1a2a1a;
}

/* Victory */
.victory-content {
  text-align: center;
  padding: 2rem;
}

.victory-content h1 {
  font-size: 2.4rem;
  color: #f0c14b;
  margin-bottom: 0.5rem;
}

.victory-content h2 {
  color: #a8d5a2;
  margin-bottom: 1rem;
}

.reward, .badge {
  font-size: 1.3rem;
  margin: 0.5rem 0;
}

.stars {
  font-size: 2rem;
  margin: 1rem 0;
}

.unlock {
  color: #f0c14b;
  margin: 1.5rem 0;
  font-weight: 700;
}

/* Settings */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.8rem 0;
  font-size: 1rem;
}

.setting-row input, .setting-row select {
  font-size: 1rem;
}

.howto-grid {
  display: grid;
  gap: 1rem;
  text-align: left;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.level-list {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0;
  text-align: left;
}

.level-item {
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  border-left: 4px solid #2a5c32;
}

.level-item.unlocked { border-left-color: #f0c14b; }
.level-item.locked { opacity: 0.5; }

/* Responsive */
@media (max-width: 600px) {
  .title { font-size: 1.7rem; }
  #hud-left { min-width: 160px; font-size: 0.8rem; }
  #hud-mission { bottom: 160px; font-size: 0.9rem; }
  .action-btn { width: 60px; height: 60px; }
  .action-btn.attack { width: 70px; height: 70px; }
}

/* Wide menu containers */
.menu-container.wide { max-width: 720px; }

.map-subtitle {
  color: #a8d5a2;
  margin-bottom: 1rem;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.25rem;
}

.level-card {
  background: linear-gradient(160deg, rgba(255,255,255,0.1), rgba(0,0,0,0.2));
  border: 2px solid rgba(240, 193, 75, 0.35);
  border-radius: 14px;
  padding: 0.85rem 0.6rem;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.level-card.unlocked:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  border-color: #f0c14b;
}

.level-card.current {
  border-color: #f0c14b;
  box-shadow: 0 0 0 2px rgba(240,193,75,0.4);
}

.level-card.completed { border-color: #48bb78; }

.level-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.level-icon { font-size: 1.6rem; }
.level-num { font-size: 0.7rem; color: #a0b0c0; letter-spacing: 1px; }
.level-name { font-size: 0.85rem; font-weight: 700; text-align: center; line-height: 1.25; }
.level-stars { font-size: 0.75rem; color: #f0c14b; }

.howto-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
  text-align: left;
}

.info-card {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(240,193,75,0.3);
  border-radius: 12px;
  padding: 1rem;
}

.info-card h3 { color: #f0c14b; margin-bottom: 0.5rem; font-size: 1rem; }
.info-card p { font-size: 0.9rem; line-height: 1.45; color: #e0e8f0; }

.ctrl-list {
  list-style: none;
  font-size: 0.9rem;
  line-height: 1.7;
}

kbd {
  display: inline-block;
  background: #1a2a3a;
  border: 1px solid #f0c14b;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 0.75rem;
  margin-right: 2px;
}

.ach-grid {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0 1.5rem;
  max-height: 55vh;
  overflow-y: auto;
}

.ach-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  text-align: left;
}

.ach-card.unlocked { border-color: rgba(240,193,75,0.5); }
.ach-card.locked { opacity: 0.55; }

.ach-icon { font-size: 1.5rem; }
.ach-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ach-text strong { color: #f0c14b; font-size: 0.95rem; }
.ach-text span { font-size: 0.8rem; color: #a0b0c0; }
.ach-status { font-size: 1.1rem; }

.settings-panel { text-align: left; margin: 1rem 0; }
.settings-hint { font-size: 0.8rem; color: #a0b0c0; margin: 0.75rem 0; }

.menu-btn.danger {
  background: linear-gradient(180deg, #c0392b 0%, #922b21 100%);
  border-color: #e74c3c;
  box-shadow: 0 4px 0 #5c1a14;
  color: #fff;
}

.muted { color: #a0b0c0; margin-top: 0.5rem; }

@media (max-width: 600px) {
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .howto-cards { grid-template-columns: 1fr; }
}

.boss-subtitle {
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: #f0c14b;
  margin-bottom: 6px;
  opacity: 0.9;
}
#boss-hud {
  min-width: min(420px, 90vw);
  padding: 12px 18px;
  border: 2px solid rgba(155, 89, 182, 0.6);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.boss-name {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 3px;
}

/* Bible Story Layer */
.bible-intro-card,
.victory-bible-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(0,0,0,0.22));
  border: 2px solid rgba(240,193,75,0.55);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  text-align: left;
  margin: 1rem auto 1.25rem;
  max-width: 680px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.bible-event { color: #f0c14b; font-weight: 800; font-size: 1rem; }
.bible-passage { color: #a8d5a2; font-weight: 800; font-size: 0.82rem; margin: 0.25rem 0 0.55rem; }
.bible-intro-card p,
.victory-bible-card p { color: #eaf1f7; line-height: 1.5; font-size: 0.92rem; }
.bible-verse, .bible-lesson,
.victory-lesson, .victory-prayer {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(0,0,0,0.18);
}
.bible-verse strong, .bible-lesson strong,
.victory-lesson strong, .victory-prayer strong {
  display: block;
  color: #f0c14b;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}
.bible-verse span, .bible-lesson span,
.victory-lesson span, .victory-prayer span { display: block; color: #fff; line-height: 1.45; font-size: 0.86rem; }

.hud-quick-actions { display: flex; align-items: center; gap: 6px; }
.hud-bible-btn {
  pointer-events: auto;
  border: 2px solid rgba(240,193,75,0.65);
  background: rgba(10,22,40,0.82);
  color: #fff;
  border-radius: 10px;
  padding: 7px 10px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.72rem;
  cursor: pointer;
}

#bible-panel {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(4,12,22,0.72);
  pointer-events: auto;
}
.bible-panel-inner {
  position: relative;
  width: min(620px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.4rem;
  border-radius: 18px;
  border: 2px solid #f0c14b;
  background: linear-gradient(155deg, #12304a, #183c54 55%, #244a37);
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
}
.bible-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}
.bible-panel-kicker { color: #f0c14b; font-size: 0.75rem; font-weight: 900; letter-spacing: 0.12em; }
.bible-panel-inner h2 { margin: 0.25rem 2rem 0.1rem 0; color: #fff; font-size: 1.65rem; }
.bible-panel-inner > p { color: #eaf1f7; line-height: 1.55; font-size: 0.95rem; }
.bible-panel-section { margin-top: 0.8rem; padding: 0.8rem; background: rgba(0,0,0,0.18); border-radius: 11px; }
.bible-panel-section strong { color: #f0c14b; font-size: 0.75rem; letter-spacing: 0.08em; }
.bible-panel-section p { margin-top: 0.25rem; color: #fff; line-height: 1.45; font-size: 0.9rem; }
.bible-panel-section.prayer { border-left: 4px solid #a8d5a2; }
.bible-panel-tip { margin-top: 0.8rem; text-align: center; color: #a8d5a2 !important; font-size: 0.75rem !important; }

.victory-bible-card { max-width: 620px; margin: 1rem auto; }
.victory-bible-card h3 { color: #fff; margin: 0.25rem 0 0; font-size: 1.25rem; }

@media (max-width: 600px) {
  .bible-intro-card { padding: 0.8rem; margin-top: 0.7rem; }
  .intro-content { padding: 1rem; }
  .intro-title { font-size: 2.1rem; margin-bottom: 0.7rem; }
  .intro-text { font-size: 1rem; margin-bottom: 0.6rem; }
  .bible-intro-card p { font-size: 0.82rem; }
  .bible-verse span, .bible-lesson span { font-size: 0.78rem; }
  .hud-bible-btn { padding: 6px 7px; font-size: 0.65rem; }
  .bible-panel-inner { padding: 1.1rem; }
  .bible-panel-inner h2 { font-size: 1.35rem; }
}


#boot-error {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 400;
  background: #8b1e1e;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
}

#game-container:not(.hidden) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
  width: 100%;
}
.shop-card {
  background: rgba(12, 28, 48, 0.85);
  border: 2px solid rgba(255, 210, 120, 0.35);
  border-radius: 16px;
  padding: 14px 12px 16px;
  text-align: center;
}
.shop-icon { font-size: 2rem; margin-bottom: 6px; }
.shop-card h3 { margin-bottom: 6px; }
.shop-card p { font-size: 0.9rem; opacity: 0.9; margin-bottom: 10px; }
