@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Cinzel+Decorative:wght@700&display=swap');

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #06070a;
  color: #e8e2d2;
  font-family: 'Cinzel', serif, sans-serif;
  touch-action: none;
}

#gameContainer {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #12151e 0%, #07080c 100%);
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* --- TOP PRESENTATION & PORTAL BAR --- */
#topBar {
  position: absolute;
  top: 14px;
  right: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 50;
}

.pill-btn {
  background: rgba(18, 22, 32, 0.78);
  border: 1px solid rgba(232, 226, 210, 0.35);
  color: #e8e2d2;
  padding: 7px 14px;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Cinzel', serif;
}

.pill-btn:hover {
  background: rgba(35, 42, 60, 0.95);
  border-color: #ffd166;
  color: #ffd166;
  transform: translateY(-1px);
}

.pill-btn.gold {
  border-color: #ffd166;
  color: #ffd166;
}

#gamepadIndicator {
  background: rgba(18, 22, 32, 0.75);
  border: 1px solid #7fe5ff;
  color: #c8f0ff;
  padding: 6px 12px;
  font-size: 11px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
}

/* --- FLOATING PROMPTS --- */
.interaction-prompt {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 15, 22, 0.9);
  border: 1px solid #ffd166;
  color: #ffd166;
  padding: 9px 20px;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: 3px;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 0 20px rgba(255, 209, 102, 0.25);
  z-index: 40;
}

.interaction-prompt:hover {
  background: rgba(28, 35, 50, 0.95);
  box-shadow: 0 0 25px rgba(255, 209, 102, 0.5);
  transform: translateX(-50%) scale(1.05);
}

/* --- CASUAL CONTROLS HELPER (BOTTOM-RIGHT) --- */
#controlsGuide {
  position: absolute;
  bottom: 16px;
  right: 18px;
  background: rgba(10, 12, 18, 0.75);
  border: 1px solid rgba(232, 226, 210, 0.2);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 11px;
  color: #a4b0c6;
  backdrop-filter: blur(8px);
  z-index: 30;
  line-height: 1.5;
  pointer-events: none;
}

#controlsGuide span.key {
  color: #ffffff;
  border: 1px solid #4a5568;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 2px;
  font-weight: 600;
}

/* Hide control guide on small mobile screens to prevent clutter */
@media (max-width: 768px) {
  #controlsGuide {
    display: none;
  }
}

/* --- MODAL DIALOGS (SHOP, LORE, VICTORY, PAUSE) --- */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 7, 10, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #0f121a;
  border: 2px solid #8a94a6;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.95), 0 0 30px rgba(200, 240, 255, 0.1);
  padding: 32px 40px;
  max-width: 680px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  position: relative;
  border-radius: 4px;
}

.modal-card::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px dashed rgba(232, 226, 210, 0.2);
  pointer-events: none;
}

.modal-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 24px;
  color: #ffd166;
  margin-bottom: 14px;
  letter-spacing: 2px;
  text-shadow: 0 0 15px rgba(255, 209, 102, 0.4);
}

.modal-text {
  font-size: 14px;
  line-height: 1.7;
  color: #e8e2d2;
  margin-bottom: 22px;
}

/* --- SHOP CHARMS GRID --- */
.charms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 18px 0 24px 0;
  text-align: left;
}

.charm-card {
  background: rgba(18, 22, 32, 0.85);
  border: 1px solid rgba(232, 226, 210, 0.2);
  border-radius: 4px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.2s ease;
}

.charm-card:hover {
  border-color: #ffd166;
  background: rgba(28, 35, 52, 0.95);
}

.charm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.charm-name {
  font-weight: 700;
  font-size: 15px;
  color: #ffd166;
}

.charm-cost {
  color: #ffd166;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.charm-desc {
  font-size: 12px;
  color: #a4b0c6;
  line-height: 1.5;
}

.charm-btn {
  background: #1e2638;
  border: 1px solid #ffd166;
  color: #ffd166;
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  border-radius: 3px;
  text-transform: uppercase;
  font-family: 'Cinzel', serif;
  transition: all 0.2s ease;
}

.charm-btn:hover:not(:disabled) {
  background: #ffd166;
  color: #0c0d14;
}

.charm-btn.equipped {
  background: rgba(76, 175, 80, 0.2);
  border-color: #4caf50;
  color: #81c784;
  cursor: default;
}

/* --- STATS GRID --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0 26px 0;
  padding: 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(232, 226, 210, 0.15);
  border-radius: 4px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #c8f0ff;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #8a94a6;
}

.action-btn {
  background: #1a2233;
  border: 1px solid #ffd166;
  color: #ffd166;
  padding: 10px 26px;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 3px;
  font-family: 'Cinzel', serif;
  transition: all 0.2s ease;
  margin: 4px;
}

.action-btn:hover {
  background: #ffd166;
  color: #0c0d14;
  box-shadow: 0 0 25px rgba(255, 209, 102, 0.6);
  transform: translateY(-2px);
}

.action-btn.secondary {
  border-color: #8a94a6;
  color: #e8e2d2;
}

.action-btn.secondary:hover {
  background: #2a3449;
  color: #ffffff;
  box-shadow: none;
}

.mode-select-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}
