/* Pixel Ricochet - Retro Pixel Art Stylesheet */

:root {
  --bg-dark: #090d16;
  --panel-bg: #0f172a;
  --panel-border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-gold: #fbbf24;
  --accent-blue: #38bdf8;
  --accent-green: #4ade80;
  --accent-red: #ef4444;
  --accent-purple: #c084fc;
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: "Courier New", Courier, monospace, monospace;
  overflow: hidden;
  touch-action: manipulation;
}

#game-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  max-width: 1024px;
  margin: 0 auto;
  position: relative;
  background-color: var(--panel-bg);
  border-left: 2px solid var(--panel-border);
  border-right: 2px solid var(--panel-border);
}

/* TOP STATUS & HUD BAR */
.hud-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #020617;
  border-bottom: 2px solid var(--panel-border);
  font-size: 13px;
  z-index: 10;
}

.hud-resource-row {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 0;
}

.resource-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(30, 41, 59, 0.6);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #334155;
  font-weight: bold;
}

.resource-item.gold { color: var(--accent-gold); }
.resource-item.wheat { color: #fde047; }
.resource-item.wood { color: #86efac; }
.resource-item.stone { color: #cbd5e1; }
.resource-item.gems { color: #67e8f9; }

.hud-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* PIXEL BUTTONS */
.pixel-btn {
  background: #1e293b;
  color: var(--text-main);
  border: 2px solid #475569;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 3px 0 #0f172a;
  transition: transform 0.05s, box-shadow 0.05s;
  border-radius: 3px;
}

.pixel-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #0f172a;
}

.pixel-btn.primary {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}

.pixel-btn.speed-2 { background: #d97706; border-color: #fbbf24; }
.pixel-btn.speed-3 { background: #b91c1c; border-color: #f87171; }
.pixel-btn.muted { opacity: 0.6; }
.pixel-btn.disabled { opacity: 0.4; cursor: not-allowed; border-color: #334155; }

/* STAGE HEADER */
.stage-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: #090d16;
  border-bottom: 1px solid #1e293b;
  font-size: 13px;
}

.stage-title {
  font-weight: bold;
  color: var(--accent-gold);
}

.stage-progress-container {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}

.stage-progress-bar {
  flex-grow: 1;
  height: 8px;
  background: #1e293b;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #334155;
}

.stage-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #4ade80);
  width: 0%;
  transition: width 0.3s;
}

#server-shield-badge {
  font-size: 11px;
  color: var(--text-muted);
}

.badge-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin: 0 3px;
}
.badge-status-dot.green { background: #22c55e; }
.badge-status-dot.orange { background: #f97316; }

/* MAIN VIEW CONTAINER */
.views-container {
  flex-grow: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.view-content.hidden {
  display: none !important;
}

/* CANVAS CONTAINER */
#canvas-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #020617;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* CARDS & PANELS */
.scroll-panel {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.pixel-card {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 6px;
  padding: 14px;
  box-shadow: 0 4px 0 #020617;
}

.pixel-card.locked {
  opacity: 0.6;
  border-style: dashed;
}

.hero-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.hero-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.rarity-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.rarity-badge.common { background: #475569; }
.rarity-badge.rare { background: #2563eb; color: #fff; }
.rarity-badge.epic { background: #9333ea; color: #fff; }

.hero-stats {
  font-size: 12px;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 12px;
}

.hero-actions, .talent-actions {
  display: flex;
  justify-content: stretch;
}
.hero-actions .pixel-btn, .talent-actions .pixel-btn {
  width: 100%;
}

.talent-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.talent-level {
  color: var(--accent-gold);
  font-weight: bold;
}
.talent-desc {
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 12px;
}

/* CHESTS TAB */
.chest-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.chest-box {
  background: #1e293b;
  border: 3px solid var(--accent-gold);
  border-radius: 8px;
  padding: 30px;
  max-width: 380px;
  box-shadow: 0 6px 0 #020617;
}

.chest-icon-large {
  font-size: 64px;
  margin-bottom: 12px;
}

/* BOTTOM NAVIGATION */
.bottom-dock {
  display: flex;
  background: #020617;
  border-top: 2px solid var(--panel-border);
  padding: 6px;
  gap: 6px;
  z-index: 10;
}

.nav-tab-btn {
  flex: 1;
  background: #0f172a;
  border: 1px solid #334155;
  color: var(--text-muted);
  padding: 8px 4px;
  font-size: 12px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.1s;
}

.nav-tab-btn.active {
  background: #1e293b;
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  box-shadow: 0 2px 0 #ca8a04;
}

/* MODALS */
.pixel-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 6, 23, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.pixel-modal.hidden {
  display: none !important;
}

.modal-content {
  background: #0f172a;
  border: 3px solid var(--accent-gold);
  border-radius: 8px;
  padding: 24px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 0 #000000;
}

.modal-content h2 {
  color: var(--accent-gold);
  margin-bottom: 12px;
  font-size: 18px;
}

.offline-gains-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
  font-weight: bold;
}
.offline-gain-item {
  background: #1e293b;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #334155;
}

@media (max-width: 600px) {
  .hud-topbar { font-size: 11px; padding: 4px 8px; }
  .resource-item { padding: 2px 5px; }
  .stage-banner { font-size: 11px; padding: 4px 8px; }
  .nav-tab-btn { font-size: 10px; padding: 6px 2px; }
}
