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

body {
  background: #0d0d1a;
  color: #e0e0e0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#game-container {
  display: grid;
  grid-template-rows: 44px auto 1fr 48px;
  grid-template-columns: 1fr 300px;
  height: 100vh;
  width: 100vw;
}

/* TOP BAR */
#top-bar {
  grid-column: 1 / -1;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 24px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}
#top-bar .stat { display: flex; align-items: center; gap: 6px; }
#top-bar .stat .label { color: #888; font-size: 11px; text-transform: uppercase; }
#top-bar .stat .value { color: #4ecca3; font-weight: bold; }
#top-bar .stat .value.cash { color: #4ecca3; }
#top-bar .stat .value.price { color: #ffd93d; }
#top-bar .stat .value.prod { color: #e94560; }

/* EVENT TICKER */
#event-ticker {
  grid-column: 1 / -1;
  display: none;
  background: #0d0d1a;
  padding: 4px 16px;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  min-height: 28px;
  border-bottom: 1px solid #0f3460;
}
.event-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  cursor: default;
}
.event-positive { background: #1a3d2e; color: #4ecca3; border: 1px solid #4ecca3; }
.event-negative { background: #3d1a1a; color: #e94560; border: 1px solid #e94560; }
.event-neutral { background: #3d3a1a; color: #ffd93d; border: 1px solid #ffd93d; }

/* EVENT POPUP */
#event-popup {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
#event-popup-inner {
  background: #16213e;
  border: 2px solid #d4a84b;
  border-radius: 10px;
  padding: 20px 28px;
  text-align: center;
  min-width: 300px;
  max-width: 420px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.7);
  animation: slideDown 0.3s ease-out;
}
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
#event-popup-icon { font-size: 28px; margin-bottom: 6px; }
#event-popup-title { font-size: 16px; font-weight: bold; color: #d4a84b; margin-bottom: 6px; }
#event-popup-desc { font-size: 13px; color: #ccc; }

/* MAIN CANVAS */
#canvas-container {
  background: #1a1a2e;
  position: relative;
  overflow: hidden;
}
#game-canvas { display: block; width: 100%; height: 100%; }

/* RIGHT PANEL */
#right-panel {
  background: #16213e;
  border-left: 1px solid #0f3460;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
}

.panel-section {
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 6px;
  padding: 10px;
}
.panel-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

#well-info {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  white-space: pre-wrap;
  line-height: 1.5;
  color: #ccc;
  min-height: 80px;
}

/* DRILLING CONTROLS */
#drilling-controls { display: none; }
.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.slider-row label {
  width: 90px;
  font-size: 11px;
  color: #aaa;
}
.slider-row input[type="range"] {
  flex: 1;
  accent-color: #e94560;
  height: 4px;
}
.slider-row .val {
  width: 40px;
  text-align: right;
  font-family: monospace;
  font-size: 12px;
  color: #4ecca3;
}

/* COMPLETION PANEL */
#completion-panel {
  display: none;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 10px;
  padding: 24px;
  z-index: 100;
  min-width: 360px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7);
}
#completion-panel h2 {
  margin-bottom: 16px;
  color: #d4a84b;
  font-size: 18px;
}
.comp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.comp-row label { color: #aaa; font-size: 13px; }
.comp-row select, .comp-row input {
  background: #1a1a2e;
  color: #e0e0e0;
  border: 1px solid #0f3460;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
}
.comp-row input[type="range"] { width: 120px; accent-color: #d4a84b; }
#comp-cost {
  font-size: 18px;
  color: #e94560;
  font-family: monospace;
  font-weight: bold;
}

/* PRODUCTION CHART */
#chart-container { position: relative; }
#production-chart { width: 100%; height: 150px; border-radius: 4px; }

/* BOTTOM BAR */
#bottom-bar {
  grid-column: 1 / -1;
  background: #16213e;
  border-top: 1px solid #0f3460;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
}

button {
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #1a5276;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
button:hover { background: #1a5276; border-color: #4ecca3; }
button.active { background: #4ecca3; color: #0d0d1a; border-color: #4ecca3; }
button.primary { background: #d4a84b; color: #0d0d1a; border-color: #d4a84b; }
button.primary:hover { background: #e8bc5e; }
button.danger { background: #e94560; color: #fff; border-color: #e94560; }

.speed-controls { display: flex; gap: 4px; margin-left: auto; }

#kick-warning {
  display: none;
  background: rgba(233, 69, 96, 0.9);
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: bold;
  animation: pulse 0.5s infinite alternate;
}
@keyframes pulse { from { opacity: 0.7; } to { opacity: 1; } }

#notification {
  display: none;
  color: #ffd93d;
  font-size: 12px;
  margin-left: 12px;
}

/* TUTORIAL OVERLAY */
#tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
#tutorial-overlay.hidden { display: none; }
#tutorial-box {
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 12px;
  padding: 32px;
  max-width: 440px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}
#tutorial-box h2 { color: #d4a84b; margin-bottom: 12px; }
#tutorial-box p { color: #ccc; font-size: 14px; line-height: 1.5; }
#tutorial-box ol { color: #ccc; font-size: 13px; line-height: 1.8; padding-left: 20px; margin-top: 8px; }

/* TECH TREE PANEL */
#techtree-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
#techtree-inner {
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 12px;
  padding: 24px;
  max-width: 1100px;
  width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}
#techtree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
#techtree-header h2 { color: #d4a84b; margin: 0; }
#techtree-header button {
  background: none; border: none; color: #888; font-size: 20px; cursor: pointer;
}
#techtree-header button:hover { color: #fff; }
#autosteer-toggle { color: #4ecca3; font-size: 12px; }
#autosteer-toggle input { margin-right: 4px; }
#techtree-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.tech-branch h3 {
  font-size: 13px; color: #d4a84b; margin-bottom: 10px;
  text-align: center; letter-spacing: 1px;
}
.tech-card {
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  transition: all 0.2s;
}
.tech-card.tech-complete { border-color: #4ecca3; background: #1a2e2e; }
.tech-card.tech-researching { border-color: #ffd93d; background: #2e2a1a; }
.tech-card.tech-available { border-color: #3a86ff; }
.tech-card.tech-locked { opacity: 0.5; }
.tech-name { font-size: 12px; font-weight: bold; color: #e0e0e0; margin-bottom: 4px; }
.tech-cost { font-size: 10px; color: #888; font-family: monospace; margin-bottom: 4px; }
.tech-effect { font-size: 10px; color: #4ecca3; margin-bottom: 4px; font-style: italic; }
.tech-prereqs { font-size: 9px; color: #e94560; margin-bottom: 4px; display: none; }
.tech-status { font-size: 10px; color: #888; margin-bottom: 4px; }
.tech-progress { display: none; height: 4px; background: #0f3460; border-radius: 2px; margin-bottom: 6px; overflow: hidden; }
.tech-progress-fill { height: 100%; background: #ffd93d; border-radius: 2px; transition: width 0.3s; width: 0%; }
.tech-card.tech-complete .tech-progress-fill { background: #4ecca3; }
.tech-research-btn { display: none; width: 100%; font-size: 11px; padding: 4px 8px; }

/* QUARTERLY REPORT */
#quarterly-report {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
#qr-inner {
  background: #16213e;
  border: 2px solid #d4a84b;
  border-radius: 12px;
  padding: 24px;
  min-width: 360px;
  max-width: 420px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}
#qr-inner h2 { color: #d4a84b; margin-bottom: 14px; font-size: 18px; }
.qr-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  color: #ccc;
}
.qr-row span:last-child { font-family: monospace; color: #e0e0e0; }

/* CORPORATE PANEL */
#corporate-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 550;
  display: flex;
  align-items: center;
  justify-content: center;
}
#corp-inner {
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 12px;
  padding: 24px;
  min-width: 380px;
  max-width: 440px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}
.corp-section {
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
}
.corp-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

/* PERKS PANEL */
#perks-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 550;
  display: flex;
  align-items: center;
  justify-content: center;
}
#perks-inner {
  background: #16213e;
  border: 2px solid #d4a84b;
  border-radius: 12px;
  padding: 24px;
  min-width: 500px;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}
#perks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.perks-category h3 {
  font-size: 13px;
  color: #d4a84b;
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.perk-card {
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  transition: all 0.2s;
}
.perk-card.perk-purchased { border-color: #4ecca3; background: #1a2e2e; }
.perk-name { font-size: 12px; font-weight: bold; color: #e0e0e0; margin-bottom: 4px; }
.perk-cost { font-size: 11px; color: #d4a84b; font-family: monospace; margin-bottom: 4px; }
.perk-desc { font-size: 10px; color: #888; margin-bottom: 4px; font-style: italic; }
.perk-sentiment { font-size: 10px; margin-bottom: 6px; }
.perk-buy-btn { width: 100%; font-size: 11px; padding: 4px 8px; }
.perk-buy-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0d0d1a; }
::-webkit-scrollbar-thumb { background: #0f3460; border-radius: 3px; }
