/* Sky Courier - Retro Arcade Stylesheet */

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

[hidden] {
  display: none !important;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #1a1a24;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #fffefa;
}

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

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- start.ng Profile Card (Per start.ng Docs) --- */
.startng-card {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  background: rgba(41, 42, 35, 0.88);
  backdrop-filter: blur(8px);
  color: #fffefa;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  z-index: 50;
  border: 1px solid rgba(216, 253, 113, 0.3);
}

.startng-card img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #d8fd71;
  object-fit: cover;
  border: 2px solid #d8fd71;
}

.startng-card b {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.startng-card span {
  font-size: 12px;
  opacity: 0.75;
}

.startng-card button {
  margin-left: 6px;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  background: #d8fd71;
  color: #1a1a24;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s;
}

.startng-card button:hover {
  background: #c5f454;
  transform: scale(1.04);
}

/* Top Right Action Buttons (Sound & Leaderboard) */
.top-actions {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 10px;
  z-index: 50;
}

.icon-btn {
  background: rgba(41, 42, 35, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: background-color 0.2s, transform 0.1s;
}

.icon-btn:hover {
  background: rgba(60, 62, 52, 0.95);
  transform: scale(1.05);
}

/* --- HUD Container --- */
.hud-container {
  position: fixed;
  top: 76px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 40;
}

.hud-panel {
  display: flex;
  gap: 16px;
  background: rgba(20, 24, 33, 0.82);
  backdrop-filter: blur(6px);
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.hud-item {
  display: flex;
  flex-direction: column;
}

.hud-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.7;
}

.hud-value {
  font-size: 18px;
  font-weight: 800;
  color: #d8fd71;
}

.hud-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 130px;
}

.bar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar-wrapper span {
  font-size: 11px;
  font-weight: 700;
  width: 38px;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transition: width 0.15s ease-out;
}

.bar-fill.hull {
  background: #2ed573;
}

.bar-fill.fuel {
  background: #ff9f43;
}

/* --- Overlays & Modals --- */
.overlay-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 14, 21, 0.78);
  backdrop-filter: blur(10px);
  z-index: 100;
  padding: 20px;
}

.overlay-screen[hidden] {
  display: none !important;
}

.card-dialog {
  position: relative;
  background: #202430;
  border: 1px solid rgba(216, 253, 113, 0.35);
  border-radius: 20px;
  padding: 32px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  text-align: center;
  animation: popIn 0.25s ease-out;
}

.card-close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, transform 0.1s;
}

.card-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.title-badge {
  display: inline-block;
  background: rgba(216, 253, 113, 0.15);
  color: #d8fd71;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

h1.game-title {
  font-size: 38px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

h1.game-title mark {
  background: none;
  color: #d8fd71;
}

.subtitle {
  font-size: 15px;
  opacity: 0.8;
  line-height: 1.5;
  margin-bottom: 24px;
}

.instructions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 26px;
  text-align: left;
}

.instruction-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.instruction-item .icon {
  font-size: 20px;
  margin-bottom: 6px;
}

.instruction-item h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #d8fd71;
}

.instruction-item p {
  font-size: 11px;
  opacity: 0.7;
  line-height: 1.4;
}

.controls-hint {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 24px;
  padding: 10px;
  background: rgba(216, 253, 113, 0.1);
  border-radius: 8px;
}

.controls-hint kbd {
  background: #333948;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  box-shadow: 0 2px 0 #1b1e26;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.btn-primary {
  background: #d8fd71;
  color: #12141c;
  box-shadow: 0 4px 16px rgba(216, 253, 113, 0.4);
}

.btn-primary:hover {
  background: #c7f646;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(216, 253, 113, 0.55);
}

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

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
}

.btn-accent {
  background: #d8fd71;
  color: #12141c;
}

/* Game Over Stats */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.stat-box {
  background: rgba(255, 255, 255, 0.06);
  padding: 14px 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-box .num {
  font-size: 24px;
  font-weight: 900;
  color: #d8fd71;
  display: block;
}

.stat-box .desc {
  font-size: 11px;
  opacity: 0.7;
  text-transform: uppercase;
}

.save-status-box {
  font-size: 13px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  margin-bottom: 22px;
  color: #ced6e0;
}

.action-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* Leaderboard Modal */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
  text-align: left;
}

.leaderboard-table th {
  padding: 10px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  text-transform: uppercase;
  opacity: 0.7;
}

.leaderboard-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.leaderboard-table tr.highlight {
  background: rgba(216, 253, 113, 0.15);
  font-weight: 700;
  color: #d8fd71;
}

.badge-rank {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 800;
  font-size: 12px;
}

.badge-rank.gold { background: #f1c40f; color: #1a1a24; }
.badge-rank.silver { background: #bdc3c7; color: #1a1a24; }
.badge-rank.bronze { background: #e67e22; color: #fff; }

/* Mobile Touch Controls */
.touch-controls {
  position: fixed;
  bottom: 24px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 60;
}

.touch-btn {
  pointer-events: auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  active: transform scale(0.92);
}

.touch-btn:active {
  background: rgba(216, 253, 113, 0.5);
  transform: scale(0.92);
}

@media (min-width: 900px) {
  .touch-controls {
    display: none;
  }
}
