/* 5-Minute Survivor: Mobile 9:16 Responsive Stylesheet */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #06080d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

/* 9:16 Centered Game Container (Pillarboxed on desktop, fits phone screens) */
#game-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: calc(100vh * (9 / 16));
  max-height: 100vh;
  aspect-ratio: 9 / 16;
  background: #0b0d14;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
  touch-action: none;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Preloader Screen */
.preloader-bar-container {
  width: 260px;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  border: 1px solid rgba(0, 255, 204, 0.35);
  overflow: hidden;
  margin-bottom: 12px;
}

.preloader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00ffcc, #ff007f);
  box-shadow: 0 0 10px #00ffcc;
  transition: width 0.15s ease;
}

.preloader-text {
  font-size: 13px;
  letter-spacing: 1px;
  color: #a0aab8;
  font-weight: 600;
}

/* In-Game HUD Pause Button (Tactile touch button for phones & desktop) */
.hud-pause-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(14, 18, 28, 0.92);
  border: 1.5px solid #00ffcc;
  color: #00ffcc;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 45;
  box-shadow: 0 0 14px rgba(0, 255, 204, 0.4);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
  line-height: 1;
}

.hud-pause-btn.hidden {
  display: none !important;
}

.hud-pause-btn:hover {
  background: rgba(0, 255, 204, 0.22);
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.65);
}

.hud-pause-btn:active {
  transform: scale(0.90);
}

/* In-Game HUD Dash Button (Tactile touch button for phones & desktop) */
.hud-sprint-btn {
  position: absolute;
  bottom: 24px;
  right: 18px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(14, 18, 28, 0.92);
  border: 2px solid #00ffcc;
  color: #00ffcc;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 45;
  box-shadow: 0 0 16px rgba(0, 255, 204, 0.45);
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  padding: 0;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overflow: hidden;
}

.hud-sprint-btn.hidden {
  display: none !important;
}

.hud-sprint-btn:hover, .hud-sprint-btn.active {
  background: rgba(0, 255, 204, 0.35);
  box-shadow: 0 0 24px rgba(0, 255, 204, 0.9);
  transform: scale(0.94);
}

.hud-sprint-btn:active {
  transform: scale(0.88);
}

.hud-dash-icon {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.hud-dash-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: rgba(0, 0, 0, 0.65);
  border-top: 2px solid rgba(0, 255, 204, 0.8);
  z-index: 1;
  pointer-events: none;
  transition: height 0.04s linear;
}

/* Pause Modal Box */
.pause-box {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Fullscreen UI Overlays inside wrapper */
.ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 13, 20, 0.92);
  backdrop-filter: blur(4px);
  z-index: 50;
  padding: 24px 20px;
  text-align: center;
  transition: opacity 0.2s ease;
}

.ui-overlay.hidden {
  display: none !important;
}

/* Menu Screen */
.game-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #ffffff 0%, #00ffcc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.game-subtitle {
  font-size: 14px;
  letter-spacing: 4px;
  color: #ffaa00;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.gold-badge {
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid #ffd700;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 24px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 280px;
}

.btn-primary {
  background: linear-gradient(180deg, #00ffcc 0%, #00aa88 100%);
  color: #061118;
  font-size: 20px;
  font-weight: 900;
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 255, 204, 0.35);
  transition: transform 0.1s ease, filter 0.1s ease;
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

.btn-secondary {
  background: #191f2e;
  border: 1px solid #333d54;
  color: #e0e8ff;
  font-size: 16px;
  font-weight: 700;
  padding: 13px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.btn-secondary:active {
  transform: scale(0.97);
  background: #232b40;
}

/* Level Up Modal Cards (Big vertical touch cards) */
.modal-header {
  font-size: 24px;
  font-weight: 900;
  color: #00ffcc;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-sub {
  font-size: 13px;
  color: #8899aa;
  margin-bottom: 20px;
}

.levelup-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.levelup-card {
  background: linear-gradient(180deg, #182030 0%, #101622 100%);
  border: 2px solid #2e3b56;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.levelup-card:active {
  transform: scale(0.96);
  border-color: #00ffcc;
  background: #1f2a40;
}

.levelup-card .card-icon {
  font-size: 32px;
  margin-bottom: 6px;
}

.levelup-card .card-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.levelup-card .card-desc {
  font-size: 12px;
  color: #99aacc;
  line-height: 1.3;
}

/* Evolution Card Highlight */
.levelup-card.card-evolution {
  border: 2px solid #ffaa00;
  background: linear-gradient(180deg, #2b1f0f 0%, #1a1208 100%);
  box-shadow: 0 0 20px rgba(255, 170, 0, 0.4);
}

.levelup-card.card-evolution .card-title {
  color: #ffcc00;
}

/* Golden Chest Modal */
.chest-box {
  background: #1a1520;
  border: 2px solid #ffcc00;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 0 30px rgba(255, 204, 0, 0.35);
}

.chest-title {
  font-size: 22px;
  font-weight: 900;
  color: #ffcc00;
  margin-bottom: 16px;
}

.chest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.chest-item {
  background: #261e2f;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Heroes Selection Modal */
.hero-cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 20px;
}

.hero-card-select {
  background: #141a26;
  border: 2px solid #27334a;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hero-card-select.selected {
  border-color: #00ffcc;
  background: #1b2638;
}

.hero-avatar {
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-avatar-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #00ffcc;
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.4);
}

.hero-name {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 2px;
}

.hero-perk {
  font-size: 11px;
  color: #00ffcc;
  font-weight: bold;
}

.hero-start-weapon {
  font-size: 11px;
  color: #8899bb;
}

/* Upgrades Hub */
.upgrades-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 330px;
  max-height: 60vh;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-right: 4px;
}

.upgrade-hub-card {
  background: #141a26;
  border: 1px solid #26334d;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.u-icon {
  font-size: 26px;
}

.u-info {
  flex: 1;
}

.u-title {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
}

.u-desc {
  font-size: 11px;
  color: #8899aa;
}

.u-btn {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: bold;
  border: none;
  cursor: pointer;
}

.u-btn.buyable {
  background: #ffd700;
  color: #000000;
}

.u-btn.disabled {
  background: #2a3345;
  color: #778899;
  cursor: not-allowed;
}

.u-btn.maxed {
  background: #114422;
  color: #00ffcc;
  cursor: default;
}

/* Game Over / Victory Stats */
.stats-box {
  background: #141926;
  border: 1px solid #29344d;
  border-radius: 14px;
  padding: 16px 20px;
  width: 100%;
  max-width: 280px;
  margin-bottom: 24px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid #1f273b;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  color: #8899aa;
}

.stat-value {
  font-weight: bold;
  color: #ffffff;
}
