/* ========================
   GALAXY TYCOON - Styles
   ======================== */

:root {
  --bg: #05050f;
  --panel: #0d0d1f;
  --panel2: #12122a;
  --border: #2a2a5a;
  --accent: #4af7c4;
  --accent2: #7b5cff;
  --gold: #ffd700;
  --red: #ff4466;
  --text: #ccd6f6;
  --muted: #6677aa;
  --font-pixel: 'Press Start 2P', monospace;
  --font-vt: 'VT323', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-vt);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

/* Le canvas Phaser est derrière l'UI */
canvas {
  position: fixed !important;
  top: 0; left: 0;
  z-index: 0;
}

/* ======= UI OVERLAY ======= */
#ui-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

/* ======= TOP BAR ======= */
#top-bar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(5,5,15,0.85);
  border-bottom: 1px solid var(--border);
  pointer-events: auto;
  flex-shrink: 0;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  min-width: 110px;
}

.stat-label {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--muted);
  letter-spacing: .05em;
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--font-vt);
  font-size: 22px;
  color: var(--accent);
}

/* ======= RIGHT PANEL ======= */
#right-panel {
  position: fixed;
  top: 70px;
  right: 0;
  width: 280px;
  bottom: 56px;
  background: rgba(5,5,15,0.92);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  overflow: hidden;
}

#panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 7px;
  padding: 10px 4px;
  cursor: pointer;
  letter-spacing: .04em;
  border-bottom: 2px solid transparent;
}

.panel-tab.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.panel-tab:hover { color: var(--text); }

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.tab-content.active { display: flex; flex-direction: column; gap: 6px; }

/* Scrollbar */
.tab-content::-webkit-scrollbar { width: 4px; }
.tab-content::-webkit-scrollbar-track { background: var(--panel); }
.tab-content::-webkit-scrollbar-thumb { background: var(--border); }

/* ======= BUILDING CARDS ======= */
.building-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.building-card:hover { border-color: var(--accent2); }

.building-icon {
  font-size: 24px;
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}

.building-info { flex: 1; min-width: 0; }

.building-name {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--text);
  margin-bottom: 3px;
}

.building-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.2;
}

.building-count {
  font-size: 13px;
  color: var(--accent2);
}

.buy-btn {
  font-family: var(--font-pixel);
  font-size: 7px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 5px 7px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.buy-btn:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg);
}

.buy-btn:disabled {
  border-color: var(--border);
  color: var(--muted);
  cursor: default;
}

/* ======= SOLAR GRID ======= */
#solar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.planet-slot {
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.planet-slot.unlocked { border-color: var(--accent2); }

.planet-slot .slot-icon { font-size: 28px; }

.planet-slot .slot-name {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--text);
}

.planet-slot .slot-status {
  font-size: 13px;
  color: var(--muted);
}

.unlock-btn {
  font-family: var(--font-pixel);
  font-size: 6px;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 4px 6px;
  cursor: pointer;
  margin-top: 2px;
}

.unlock-btn:hover:not(:disabled) {
  background: var(--gold);
  color: var(--bg);
}

.unlock-btn:disabled {
  border-color: var(--border);
  color: var(--muted);
  cursor: default;
}

/* ======= LOG BOX ======= */
#log-box {
  border-top: 1px solid var(--border);
  padding: 8px;
  flex-shrink: 0;
  max-height: 110px;
  overflow: hidden;
}

.log-title {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--muted);
  margin-bottom: 5px;
}

#log-entries { display: flex; flex-direction: column; gap: 2px; }

.log-entry {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.3;
}

.log-entry.new { color: var(--accent); }

/* ======= BOTTOM BAR ======= */
#bottom-bar {
  position: fixed;
  bottom: 0; left: 0;
  right: 280px;
  height: 48px;
  background: rgba(5,5,15,0.9);
  border-top: 1px solid var(--border);
  pointer-events: auto;
  display: flex;
  align-items: center;
}

#monetize {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--muted);
}

.kofi-btn {
  background: transparent;
  border: 1px solid #ff5e5b;
  color: #ff5e5b;
  padding: 5px 10px;
  font-family: var(--font-pixel);
  font-size: 7px;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.kofi-btn:hover {
  background: #ff5e5b;
  color: white;
}

.ad-placeholder {
  border: 1px dashed var(--border);
  padding: 5px 12px;
  color: var(--muted);
  font-size: 12px;
}

/* ======= CLICK FEEDBACK ======= */
.click-popup {
  position: fixed;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--accent);
  pointer-events: none;
  z-index: 100;
  animation: floatUp .8s forwards;
}

@keyframes floatUp {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-40px); }
}

/* ======= RESPONSIVE ======= */
@media (max-width: 700px) {
  #right-panel { width: 220px; }
  #bottom-bar { right: 220px; }
  .stat-box { min-width: 80px; }
}