* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #020617; }
body { font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; color: #e2e8f0; }

.hidden { display: none !important; }

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #0f172a 0%, #020617 75%);
  gap: 16px; padding: 24px; text-align: center;
}
.overlay h1 { font-size: 48px; letter-spacing: 12px; color: #38bdf8; text-shadow: 0 0 24px rgba(56,189,248,.5); }
.overlay .tag { color: #64748b; letter-spacing: 4px; margin-top: -8px; }
.overlay .panel {
  max-width: 560px; background: #0f172a; border: 1px solid #1e293b; border-radius: 8px;
  padding: 20px 28px; text-align: left; line-height: 1.8; font-size: 14px; color: #cbd5e1;
}
.overlay .panel h2 { color: #38bdf8; font-size: 15px; margin: 8px 0 4px; }
.overlay .diff { display: flex; gap: 24px; font-size: 15px; }
.overlay .diff label { cursor: pointer; }
.overlay button {
  background: #0369a1; color: #f0f9ff; border: 1px solid #38bdf8; border-radius: 6px;
  font-size: 18px; letter-spacing: 6px; padding: 12px 48px; cursor: pointer;
}
.overlay button:hover { background: #0284c7; }
#endText { max-width: 480px; line-height: 1.8; color: #cbd5e1; }

#gameUI { display: flex; width: 100%; height: 100%; }
#main { position: relative; flex: 1; }
#gameCanvas { display: block; cursor: crosshair; background: #000; }

#messages {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  pointer-events: none; z-index: 5;
}
#messages .msg {
  background: rgba(2,6,23,.8); border: 1px solid #334155; border-radius: 4px;
  padding: 4px 14px; font-size: 13px; color: #fbbf24; white-space: nowrap;
}

#sidebar {
  width: 200px; min-width: 200px;
  background: linear-gradient(180deg, #0f172a 0%, #0b1120 100%);
  border-left: 1px solid #1e293b;
  display: flex; flex-direction: column; padding: 10px; gap: 6px; overflow-y: auto;
}
#logo {
  text-align: center; font-size: 20px; font-weight: 800; letter-spacing: 6px; color: #38bdf8;
  padding: 6px 0 10px; border-bottom: 1px solid #1e293b; text-shadow: 0 0 12px rgba(56,189,248,.4);
}
#logo span { display: block; font-size: 9px; letter-spacing: 4px; color: #475569; margin-top: 2px; }
#sidebar .row {
  display: flex; justify-content: space-between; font-size: 14px; color: #94a3b8;
  background: rgba(30,41,59,.5); border: 1px solid #1e293b; border-radius: 4px; padding: 5px 10px;
}
#sidebar .row .val { color: #fbbf24; font-weight: 700; }
#powerBar {
  height: 10px; background: #1e293b; border-radius: 5px; overflow: hidden;
  border: 1px solid #334155;
}
#powerFill { height: 100%; width: 0; background: #22c55e; transition: width .2s; box-shadow: 0 0 8px rgba(34,197,94,.6); }
#sidebar h3 {
  font-size: 12px; color: #64748b; letter-spacing: 4px;
  border-bottom: 1px solid #1e293b; padding-bottom: 4px; margin-top: 6px;
}
#bButtons, #uButtons { display: flex; flex-direction: column; gap: 4px; }
#bButtons .btn { border-left: 3px solid #0369a1; }
#uButtons .btn { border-left: 3px solid #15803d; }
.btn.sell { border-left: 3px solid #b45309; }
.btn.sell.placing { border-color: #fbbf24; background: #453408; }

.btn {
  display: flex; justify-content: space-between; align-items: center;
  background: #1f2937; color: #e2e8f0; border: 1px solid #334155; border-radius: 4px;
  padding: 7px 10px; font-size: 13px; cursor: pointer; user-select: none;
  transition: transform .08s, border-color .08s;
}
.btn:hover:not(:disabled) { border-color: #38bdf8; transform: translateX(-2px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn .bcost { color: #fbbf24; font-size: 12px; }
.btn .bright { display: flex; align-items: center; gap: 6px; }
.btn .qcount {
  color: #0f172a; background: #38bdf8; border-radius: 8px;
  font-size: 11px; font-weight: 700; padding: 0 6px; line-height: 16px;
}
.btn.ready { border-color: #22c55e; animation: pulse 1s infinite; }
.btn.placing { border-color: #fbbf24; background: #453408; }
@keyframes pulse { 50% { box-shadow: 0 0 10px rgba(34,197,94,.8); } }

#minimap {
  border: 1px solid #334155; border-radius: 4px; cursor: pointer; margin-top: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
#infoPanel {
  border: 1px solid #1e293b; border-radius: 4px; background: rgba(30,41,59,.4);
  margin-top: 4px; padding: 8px;
  font-size: 12px; color: #94a3b8; line-height: 1.7; min-height: 60px;
}
#infoPanel .title { color: #e2e8f0; font-size: 13px; font-weight: 700; }
#infoPanel .hpbar { height: 6px; background: #1e293b; border-radius: 3px; overflow: hidden; margin: 4px 0; }
#infoPanel .hpfill { height: 100%; background: #22c55e; }
#hints {
  margin-top: auto; padding-top: 8px; border-top: 1px solid #1e293b;
  font-size: 11px; color: #475569; line-height: 1.8; text-align: center;
}
