/* Shadow Ninja: Idle Dojo - Retro Pixel Theme v2 */

:root {
  --bg-dark: #080b14;
  --panel-bg: #101726;
  --panel-border: #1e293b;
  --accent-gold: #fbbf24;
  --accent-crimson: #ef4444;
  --accent-cyan: #38bdf8;
  --accent-jade: #34d399;
  --accent-purple: #c084fc;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* {
  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: 900px;
  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 & RESOURCE HUD */
.hud-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #040711;
  border-bottom: 2px solid #1e293b;
  font-size: 13px;
  z-index: 10;
}

.hud-resource-row {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 0;
}

.resource-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(30, 41, 59, 0.7);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #334155;
  font-weight: bold;
}

.resource-item.gold { color: var(--accent-gold); }
.resource-item.scrolls { color: var(--accent-cyan); }
.resource-item.gems { color: #f472b6; }

.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: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 3px 0 #070d19;
  transition: transform 0.05s, box-shadow 0.05s;
  border-radius: 4px;
  text-align: center;
}

.pixel-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #070d19;
}

.pixel-btn.primary {
  background: #991b1b;
  border-color: var(--accent-crimson);
  color: #ffffff;
}

.pixel-btn.gold-btn {
  background: #854d0e;
  border-color: var(--accent-gold);
  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; box-shadow: none; }

/* STAGE & WAVE PROGRESS BANNER */
.stage-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #080d1a;
  border-bottom: 2px solid #1e293b;
  font-size: 12px;
}

.zone-title {
  font-weight: bold;
  color: var(--accent-gold);
}

.stage-progress-container {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
}

.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, #ef4444, #fbbf24);
  width: 0%;
  transition: width 0.3s;
}

#server-shield-badge {
  font-size: 11px;
  color: var(--text-muted);
}

/* 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 & PIXEL CANVAS */
#canvas-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #040711;
  overflow: hidden;
  padding: 6px;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 640px;
  aspect-ratio: 320 / 192;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  border: 1px solid #334155;
}

/* PANEL HEADER BANNERS */
.panel-header-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #0a0f1d;
  border-bottom: 2px solid #1e293b;
}

.panel-header-banner h2 {
  font-size: 14px;
  color: var(--accent-gold);
}

.squad-counter-badge {
  font-size: 12px;
  font-weight: bold;
  background: #1e293b;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #334155;
}

/* CARDS & SCROLL PANELS */
.scroll-panel {
  flex-grow: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.pixel-card {
  background: #141c2e;
  border: 2px solid #2d3b55;
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 4px 0 #070d19;
  display: flex;
  flex-direction: column;
}

.pixel-card.locked {
  opacity: 0.65;
  border-style: dashed;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.level-badge {
  color: var(--accent-gold);
  font-weight: bold;
  font-size: 11px;
}

.card-desc {
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 10px;
  flex-grow: 1;
}

.rarity-tag {
  font-size: 9px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid currentColor;
  display: inline-block;
  letter-spacing: 1px;
}

/* SHRINE VIEW */
.shrine-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  text-align: center;
  overflow-y: auto;
}

.shrine-box {
  background: #141c2e;
  border: 3px solid var(--accent-gold);
  border-radius: 8px;
  padding: 20px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 6px 0 #070d19;
}

.shrine-icon-large {
  font-size: 52px;
  margin-bottom: 8px;
}

.rarity-rates-table {
  background: #080d1a;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 10px;
  margin-top: 14px;
  font-size: 11px;
  text-align: left;
}

.rates-header {
  font-weight: bold;
  color: #94a3b8;
  margin-bottom: 6px;
  text-align: center;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 4px;
}

.rate-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-weight: bold;
}

.rate-row.common { color: #94a3b8; }
.rate-row.uncommon { color: #22c55e; }
.rate-row.epic { color: #c084fc; }
.rate-row.legendary { color: #fbbf24; }
.rate-row.mythic { color: #ef4444; }

/* BOTTOM NAVIGATION */
.bottom-dock {
  display: flex;
  background: #040711;
  border-top: 2px solid #1e293b;
  padding: 6px;
  gap: 6px;
  z-index: 10;
}

.nav-tab-btn {
  flex: 1;
  background: #101726;
  border: 1px solid #2d3b55;
  color: var(--text-muted);
  padding: 7px 2px;
  font-size: 11px;
  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(4, 7, 17, 0.90);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.pixel-modal.hidden {
  display: none !important;
}

.modal-content {
  background: #101726;
  border: 3px solid var(--accent-gold);
  border-radius: 8px;
  padding: 22px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 0 #000000;
}

.modal-chest-icon {
  font-size: 54px;
  margin-bottom: 10px;
  animation: chestWiggle 1.5s infinite ease-in-out;
}

@keyframes chestWiggle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-4deg); }
  75% { transform: scale(1.1) rotate(4deg); }
}

.chest-card-preview {
  background: #080d1a;
  border: 2px solid #334155;
  border-radius: 6px;
  padding: 14px;
  margin: 14px 0;
}

.offline-gains-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 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 6px; }
  .resource-item { padding: 2px 5px; }
  .stage-banner { font-size: 10px; padding: 4px 6px; }
  .nav-tab-btn { font-size: 9px; padding: 5px 1px; }
}