* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 12px;
  background: #12121a;
  color: #f0f0f5;
  font-family: 'Courier New', Courier, monospace;
  display: flex;
  justify-content: center;
}

#game-container {
  background: #2a2a3a;
  border: 4px solid #3e3e56;
  border-radius: 8px;
  padding: 16px;
  max-width: 720px;
  width: 100%;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #3e3e56;
  padding-bottom: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 8px;
}

.header-left { display: flex; align-items: center; gap: 10px; }
h1 { margin: 0; font-size: 22px; color: #00ff88; }

.season-badge {
  font-size: 9px;
  font-weight: bold;
  background: #1e3a2a;
  color: #00ff88;
  border: 1px solid #00ff88;
  padding: 3px 7px;
  border-radius: 3px;
}

#wallet-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.wallet-chip {
  background: #1e1e2d;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11px;
  color: #aaaacc;
}
.wallet-chip.sol strong { color: #b44eff; }
.wallet-chip.eth strong { color: #6ea8fe; }

#game-message {
  text-align: center;
  font-size: 12px;
  color: #00ff88;
  min-height: 16px;
  opacity: 0;
  transition: opacity 0.2s;
}
#game-message.visible { opacity: 1; }

#disaster-banner {
  display: none;
  align-items: center;
  gap: 10px;
  background: #3a2020;
  border: 2px solid #ff6b35;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 11px;
}
#disaster-banner.visible { display: flex; }
#disaster-banner .db-emoji { font-size: 22px; }
#disaster-banner .db-text { display: flex; flex-direction: column; gap: 2px; }
#disaster-banner .db-text strong { color: #ff9a6a; }
#disaster-banner .db-text small { color: #ccccee; font-size: 10px; }

#canvas-wrap {
  position: relative;
  border: 3px solid #00ff88;
  border-radius: 6px;
  overflow: hidden;
  background: #111;
  margin-bottom: 10px;
}

canvas {
  display: block;
  width: 100%;
  cursor: crosshair;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#action-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #00ff88;
  font-size: 11px;
  font-weight: bold;
  padding: 5px 12px;
  border-radius: 14px;
  pointer-events: none;
  white-space: nowrap;
}

#farm-hud {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.farm-stat {
  background: #1e1e2d;
  border-radius: 4px;
  padding: 6px 4px;
  text-align: center;
  font-size: 10px;
  color: #8888aa;
}

.farm-stat strong {
  display: block;
  color: #f0f0f5;
  font-size: 13px;
  margin-top: 2px;
}

.farm-stat.hot strong { color: #00ff88; animation: pulse 1.2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#tool-bar { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }

.tool-btn {
  flex: 1;
  min-width: 100px;
  background: #2a2a3a;
  color: #f0f0f5;
  border: 2px solid #3e3e56;
  padding: 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.tool-btn.selected { border-color: #00ff88; background: #1a3a2a; }

#toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e1e2d;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.toolbar-label { font-size: 10px; color: #8888aa; font-weight: bold; }
#seed-palette { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }

.seed-btn {
  background: #2a2a3a;
  color: #f0f0f5;
  border: 2px solid #3e3e56;
  padding: 5px 8px;
  font-size: 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.seed-btn span { display: block; font-size: 8px; color: #8888aa; }
.seed-btn.selected { border-color: #00ff88; background: #1a3a2a; }

#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e1e2d;
  padding: 12px;
  border-radius: 6px;
  flex-wrap: wrap;
  gap: 10px;
}

.hud-item { text-align: center; min-width: 60px; }
.hud-item .label { font-size: 9px; color: #8888aa; text-transform: uppercase; display: block; }
.hud-item span:not(.label) { font-size: 14px; font-weight: bold; }
.status-idle { color: #8888aa; }
.status-active { color: #00ff88; }

button {
  background: #00ff88;
  color: #1a1a24;
  border: none;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { margin-left: auto; }
.btn-expand {
  background: #ff7518;
  color: #1a1a24;
  font-size: 11px;
  padding: 9px 12px;
}
.btn-empire {
  background: #b44eff;
  color: #fff;
}

#inventory-panel, #market-panel {
  background: #1e1e2d;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.panel-title {
  display: block;
  font-size: 11px;
  font-weight: bold;
  color: #00ff88;
  margin-bottom: 8px;
}

#inventory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.inv-chip {
  background: #2a2a3a;
  border: 1px solid #3e3e56;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
}

.inv-empty { font-size: 10px; color: #8888aa; }

.market-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 11px;
}

.market-row label { display: flex; align-items: center; gap: 6px; }
.market-row select, .market-row input {
  background: #2a2a3a;
  border: 1px solid #3e3e56;
  color: #f0f0f5;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: inherit;
}

.market-quote {
  font-size: 11px;
  color: #ccccee;
  margin-bottom: 10px;
}
.market-quote strong { color: #00ff88; }

#sell-btn { width: 100%; margin: 0; }

kbd {
  background: #3e3e56;
  padding: 1px 4px;
  font-size: 9px;
  color: #00ff88;
  border-radius: 2px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}
.modal.hidden { display: none; }

.modal-box {
  background: #2a2a3a;
  border: 3px solid #00ff88;
  border-radius: 8px;
  padding: 24px;
  max-width: 380px;
  width: 90%;
  text-align: center;
}

.modal-box h2 { color: #00ff88; margin: 0 0 8px; }
.modal-sub { font-size: 10px; color: #8888aa; margin: 0 0 16px; }
.modal-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.modal-stats .label { font-size: 9px; color: #8888aa; text-transform: uppercase; display: block; }
.modal-stats .big { font-size: 22px; color: #00ff88; font-weight: bold; }
.modal-wide { grid-column: 1 / -1; }

@media (max-width: 600px) {
  body { padding: 4px; }
  #game-container { padding: 8px; border-width: 2px; }
  h1 { font-size: 18px; }
  #wallet-bar { gap: 6px; }
  .wallet-chip { padding: 4px 8px; font-size: 11px; }
  #action-hint { display: none; }
  
  /* Make stats grid 3 columns so text has space */
  #farm-hud { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .farm-stat { padding: 6px 4px; font-size: 11px; }
  .farm-stat strong { font-size: 14px; margin-top: 3px; }
  
  /* Wrap tool button bar in rows of 2 to avoid squeezing */
  #tool-bar { display: flex; flex-wrap: wrap; gap: 6px; }
  .tool-btn { flex: 1 1 calc(50% - 4px); min-width: 120px; padding: 10px; font-size: 13px; }
  
  .seed-btn { padding: 6px 10px; font-size: 11px; }
  .seed-btn span { font-size: 9px; }
  
  #hud { padding: 10px; gap: 8px; justify-content: center; }
  .hud-item { min-width: 60px; }
  .hud-item .label { font-size: 10px; }
  .hud-item span:not(.label) { font-size: 14px; }
  button { padding: 10px 16px; font-size: 13px; }
  .btn-expand { padding: 10px 12px; }
}
