:root {
  --bg: #0f1115;
  --panel: #171a21;
  --text: #e6f0ff;
  --muted: #9fb0c6;
  --accent: #00d18f;
  --danger: #ff4d4f;
  --gold: #ffcf40;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #202534;
}

.app-header h1 { margin: 0; font-size: 20px; }

.stats { display: flex; gap: 16px; align-items: center; }
.stat { color: var(--muted); }
.stat span:last-child { color: var(--gold); font-weight: 700; margin-left: 4px; }

.actions { display: flex; gap: 8px; }
button {
  background: #23283a;
  color: var(--text);
  border: 1px solid #2d3550;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}
button:hover { 
  border-color: var(--accent); 
  background: #2a3148;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 209, 143, 0.2);
}
button:active {
  transform: translateY(0);
}
button.danger { 
  border-color: var(--danger); 
  color: #ffd7d7; 
}
button.danger:hover {
  border-color: #ff6b6b;
  box-shadow: 0 2px 8px rgba(255, 77, 79, 0.2);
}

.app-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid #202534;
  border-radius: 12px;
  padding: 12px;
}
.panel h2 { margin: 0 0 8px 0; font-size: 16px; color: var(--muted); }

.list { display: flex; flex-wrap: wrap; gap: 8px; }

.goblin-card, .mine-card {
  background: #1c2030;
  border: 1px solid #2a3148;
  border-radius: 10px;
  padding: 10px;
  min-width: 120px;
  cursor: pointer;
}
.goblin-card.selected, .mine-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,209,143,0.2) inset; }
.goblin-level { font-weight: 700; color: #a0c4ff; }
.mine-level { font-weight: 700; color: #ffd166; }
.capacity { color: var(--muted); font-size: 12px; }
.rate { color: #9effa0; font-size: 12px; }
.assigned { color: var(--muted); font-size: 12px; }

.merge-hint, .hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.app-footer {
  padding: 12px 16px;
  border-top: 1px solid #202534;
  color: var(--muted);
}

@media (max-width: 900px) {
  .app-main { grid-template-columns: 1fr; }
}

/* Canvas layout for bulldozer game */
.canvas-wrap {
  width: 100%;
  height: min(70vh, 720px);
  border: 1px solid #202534;
  background: linear-gradient(135deg, #0b0d12 0%, #151820 100%);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.canvas-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  image-rendering: crisp-edges;
  image-rendering: -webkit-optimize-contrast;
}

.game-tips {
  margin-top: 12px;
  padding: 12px;
  background: rgba(0, 209, 143, 0.05);
  border: 1px solid rgba(0, 209, 143, 0.2);
  border-radius: 8px;
}

.game-tips p {
  margin: 0 0 8px 0;
  color: var(--accent);
}

.game-tips ul {
  margin: 0;
  padding-left: 20px;
  list-style: none;
}

.game-tips li {
  margin: 4px 0;
  color: var(--muted);
  font-size: 14px;
}

.game-tips li::before {
  content: '▸ ';
  color: var(--accent);
  margin-right: 4px;
}

/* Tutorial overlay */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tutorial-content {
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 209, 143, 0.3);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { 
    transform: translateY(30px);
    opacity: 0;
  }
  to { 
    transform: translateY(0);
    opacity: 1;
  }
}

.tutorial-content h2 {
  margin: 0 0 20px 0;
  color: var(--accent);
  text-align: center;
  font-size: 24px;
}

.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.step {
  display: flex;
  align-items: start;
  gap: 16px;
  padding: 12px;
  background: rgba(0, 209, 143, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(0, 209, 143, 0.2);
}

.step-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.step h3 {
  margin: 0 0 4px 0;
  color: var(--text);
  font-size: 16px;
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  background: #2a3148;
  border: 1px solid #3d4663;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  margin: 0 2px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.tutorial-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #202534;
}

.btn-primary {
  background: var(--accent);
  color: #0f1115;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: #00f5a0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 209, 143, 0.4);
}

.tutorial-footer label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.tutorial-footer input[type="checkbox"] {
  cursor: pointer;
}


