/* ── Reset + Base ─────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green:   #44ff99;
  --green-d: #00cc55;
  --green-x: #002211;
  --cyan:    #44ffff;
  --yellow:  #ffee44;
  --orange:  #ff8844;
  --red:     #ff4444;
  --blue:    #4499ff;
  --bg:      #03030a;
  --panel:   rgba(5, 5, 22, 0.97);
  --border:  #001a0e;
  --text:    #ccddcc;
  --text-d:  #557755;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--green);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
}

canvas { display: block; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #050510; }
::-webkit-scrollbar-thumb { background: #002211; border-radius: 2px; }

/* ── HUD (top bar) ────────────────────────────────────────── */
#hud {
  position: fixed; top: 0; left: 0; right: 0; height: 54px;
  background: var(--panel);
  border-bottom: 2px solid #002211;
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px; z-index: 100;
}

.hud-logo {
  font-size: 8px; color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan);
  white-space: nowrap; line-height: 1.6;
}
.hud-logo span { font-size: 6px; color: var(--green-d); }

.hud-sep { width: 1px; height: 32px; background: var(--green-x); flex-shrink: 0; }

.hud-stat { display: flex; flex-direction: column; gap: 3px; }
.hud-lbl  { font-size: 6px; color: var(--text-d); letter-spacing: .5px; }
.hud-val  { font-size: 13px; color: var(--green); }

#date-val { font-size: 9px; color: var(--yellow); }

#rep-wrap { display: flex; flex-direction: column; gap: 4px; }
#rep-bar  { width: 80px; height: 9px; background: #0a0a18; border: 1px solid var(--green-x); border-radius: 3px; overflow: hidden; }
#rep-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width .4s, background .4s; }

.hud-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px; padding: 6px 10px;
  background: rgba(0,255,136,.06);
  border: 1px solid #004422;
  color: var(--green-d); cursor: pointer;
  white-space: nowrap; border-radius: 2px;
  transition: all .15s;
}
.hud-btn:hover {
  background: rgba(0,255,136,.2);
  border-color: var(--green);
  color: var(--green);
}

.hud-controls {
  margin-left: auto;
  font-size: 6px; color: #334433;
  line-height: 2.2; text-align: right;
}

/* ── Left Panel — Projects ────────────────────────────────── */
#lpanel {
  position: fixed; top: 54px; left: 0; width: 220px; bottom: 0;
  background: var(--panel);
  border-right: 2px solid var(--border);
  padding: 12px 10px;
  overflow-y: auto; z-index: 90;
  display: flex; flex-direction: column; gap: 14px;
}

.panel-title {
  font-size: 7px; color: var(--cyan);
  border-bottom: 1px solid var(--green-x);
  padding-bottom: 6px; margin-bottom: 8px;
}

.panel-empty {
  color: var(--text-d); font-size: 7px; line-height: 2;
}

.proj-card {
  border: 1px solid #1a3322;
  padding: 8px 9px; margin-bottom: 7px;
  background: rgba(0,255,136,.025);
  border-radius: 2px;
}
.proj-card.pending { border-color: #332211; background: rgba(255,136,68,.025); }

.proj-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 3px;
}
.proj-company { font-size: 8px; color: var(--cyan); }
.proj-pct     { font-size: 7px; color: var(--yellow); }
.proj-service { font-size: 7px; color: var(--green); margin-bottom: 4px; }
.proj-employee { font-size: 6px; color: var(--blue); margin-bottom: 5px; }
.proj-employee.warn { color: var(--orange); }

.pbar-wrap { height: 5px; background: #0a0a18; border-radius: 2px; overflow: hidden; margin-bottom: 5px; }
.pbar { height: 100%; background: var(--green); border-radius: 2px; transition: width .5s; }

.proj-reward { font-size: 6px; color: var(--orange); }

/* ── Right Panel — Employees ──────────────────────────────── */
#rpanel {
  position: fixed; top: 54px; right: 0; width: 200px; bottom: 0;
  background: var(--panel);
  border-left: 2px solid var(--border);
  padding: 12px 10px;
  overflow-y: auto; z-index: 90;
  display: flex; flex-direction: column; gap: 14px;
}

.emp-card {
  border: 1px solid #1a2233;
  border-left: 3px solid currentColor;
  padding: 8px 9px; margin-bottom: 7px;
  background: rgba(68,136,255,.02);
  border-radius: 2px;
}
.emp-name   { font-size: 8px; color: var(--text); margin-bottom: 3px; }
.emp-role   { font-size: 6px; margin-bottom: 4px; }
.emp-status { font-size: 6px; margin-bottom: 4px; }
.emp-status.working { color: var(--yellow); }
.emp-status.idle    { color: var(--text-d); }
.emp-salary { font-size: 6px; color: var(--orange); }

.cost-row {
  display: flex; justify-content: space-between;
  font-size: 6px; color: var(--orange); padding: 2px 0;
}
.cost-total {
  font-size: 7px; color: var(--yellow);
  border-top: 1px solid var(--green-x); margin-top: 5px; padding-top: 5px;
}

/* ── Toast Messages ───────────────────────────────────────── */
#msgs {
  position: fixed; bottom: 24px;
  left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex;
  flex-direction: column; align-items: center; gap: 4px;
  pointer-events: none;
}
.msg {
  font-size: 8px; padding: 7px 16px;
  background: rgba(5,5,22,.97);
  border: 1px solid currentColor;
  white-space: nowrap;
  animation: msgfade 3.8s forwards;
  border-radius: 2px;
}
.msg-s { color: var(--green); }
.msg-i { color: var(--blue);  }
.msg-w { color: var(--yellow);}
.msg-e { color: var(--red);   }

@keyframes msgfade {
  0%,65% { opacity: 1; transform: translateY(0); }
  100%   { opacity: 0; transform: translateY(-10px); }
}

/* ── Modal ────────────────────────────────────────────────── */
#modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.78); z-index: 300;
  align-items: center; justify-content: center;
}
#modal-bg.show { display: flex; }

#modal {
  background: #04041a;
  border: 2px solid var(--green);
  padding: 24px 28px;
  min-width: 340px; max-width: 460px;
  border-radius: 3px;
  box-shadow: 0 0 40px rgba(0,255,136,.15);
}
#modal h2 {
  font-size: 11px; color: var(--cyan);
  margin-bottom: 18px; line-height: 1.5;
}

.mrow {
  display: flex; justify-content: space-between;
  align-items: flex-start;
  font-size: 7px; margin-bottom: 9px;
  color: var(--text-d); line-height: 1.6;
}
.mval { color: var(--text); text-align: right; max-width: 55%; }

.mdesc {
  font-size: 7px; color: var(--text-d);
  line-height: 2.2; margin: 10px 0 4px;
}

.modal-btns { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.mbtn {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px; padding: 9px 16px;
  background: rgba(0,255,136,.08);
  border: 2px solid var(--green);
  color: var(--green); cursor: pointer;
  border-radius: 2px; transition: all .15s;
}
.mbtn:hover  { background: rgba(0,255,136,.28); }
.mbtn-red    { border-color: var(--red); color: var(--red); background: rgba(255,68,68,.06); }
.mbtn-red:hover { background: rgba(255,68,68,.22); }

/* Hire modal */
#hire-list { max-height: 260px; overflow-y: auto; margin: 12px 0; }
.hire-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 10px; border: 1px solid #1a2233; margin-bottom: 6px;
  background: rgba(0,0,0,.2);
}
.hire-name   { font-size: 8px; color: var(--text); margin-bottom: 3px; }
.hire-role   { font-size: 6px; }
.hire-salary { font-size: 7px; color: var(--orange); margin-bottom: 2px; }
.hire-cost   { font-size: 6px; color: var(--text-d); margin-bottom: 6px; }
.hire-btn    { font-size: 6px !important; padding: 5px 10px !important; }

/* ── Tutorial Overlay ─────────────────────────────────────── */
#tutorial {
  position: fixed;
  bottom: 30px; left: 50%; transform: translateX(-50%);
  z-index: 250; pointer-events: none;
  min-width: 480px; max-width: 620px;
}

.tut-card {
  background: rgba(4,4,20,.97);
  border: 2px solid var(--cyan);
  padding: 20px 24px;
  pointer-events: all;
  border-radius: 3px;
  box-shadow: 0 0 30px rgba(68,255,255,.12);
}
.tut-step  { font-size: 6px; color: var(--text-d); margin-bottom: 6px; }
.tut-title { font-size: 10px; color: var(--cyan); margin-bottom: 12px; line-height: 1.5; }
.tut-body  { font-size: 7px; color: var(--text); line-height: 2.4; margin-bottom: 10px; }
.tut-hint  { font-size: 7px; color: var(--green-d); line-height: 2; margin-bottom: 14px; }

.thl { color: var(--yellow); }

.tut-btns { display: flex; gap: 10px; }
.tut-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px; padding: 8px 14px;
  background: rgba(0,255,136,.08);
  border: 2px solid var(--green);
  color: var(--green); cursor: pointer;
  border-radius: 2px; transition: all .15s;
}
.tut-btn:hover    { background: rgba(0,255,136,.25); }
.tut-btn-done     { border-color: var(--cyan); color: var(--cyan); }
.tut-btn-done:hover { background: rgba(68,255,255,.2); }
.tut-btn-skip {
  background: none; border-color: var(--text-d);
  color: var(--text-d); font-size: 7px;
}
.tut-btn-skip:hover { color: var(--text); border-color: var(--text); }

/* ── Game Over ────────────────────────────────────────────── */
#gameover {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.94); z-index: 500;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 20px;
}
#gameover.show { display: flex; }

.go-title { font-size: 28px; color: var(--red); text-shadow: 0 0 20px var(--red); }
.go-sub   { font-size: 10px; color: var(--yellow); }
.go-info  { font-size: 7px; color: var(--green-d); line-height: 2.5; text-align: center; }
.go-btn   {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px; padding: 12px 22px;
  background: rgba(0,255,136,.1);
  border: 2px solid var(--green);
  color: var(--green); cursor: pointer;
  border-radius: 2px; transition: all .15s;
}
.go-btn:hover { background: rgba(0,255,136,.3); }
.go-btn-load  { border-color: var(--yellow); color: var(--yellow); }
.go-btn-load:hover { background: rgba(255,238,68,.2); }
