/* AI 创业模拟器 —— 暗色科技风 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0b0f1a;
  --bg2: #111827;
  --card: #151d2e;
  --card2: #1a2438;
  --line: #2a3650;
  --text: #dbe4f0;
  --dim: #8b98ad;
  --green: #34d399;
  --cyan: #22d3ee;
  --yellow: #fbbf24;
  --red: #f87171;
  --purple: #a78bfa;
  --blue: #60a5fa;
}

html, body { height: 100%; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #16233f 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100%;
}

.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--card2);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s;
  user-select: none;
  min-height: 44px;
}
.btn:hover { background: #223052; border-color: #3b4d75; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, #059669, #0891b2);
  border-color: transparent;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 18px rgba(8, 145, 178, .35);
}
.btn-primary:hover { filter: brightness(1.12); background: linear-gradient(135deg, #059669, #0891b2); }
.btn-danger { background: #3a1620; border-color: #7f2d3f; color: #fda4af; }
.btn-ghost { background: transparent; }
.icon-btn {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 17px;
  width: 40px; height: 40px;
  cursor: pointer;
  color: var(--text);
}
.icon-btn:active { transform: scale(.94); }

/* ---------- 开始界面 ---------- */
#screen-start {
  display: flex; align-items: center; justify-content: center;
  padding: 24px 14px;
}
.start-wrap { width: 100%; max-width: 560px; }
.logo-block { text-align: center; margin-bottom: 22px; }
.logo-glyph {
  font-size: 54px;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(34, 211, 238, .6));
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.game-title {
  font-size: 34px;
  letter-spacing: 4px;
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 8px 0 6px;
}
.game-sub { color: var(--dim); font-size: 13px; }

.start-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
}
.fld-label { font-size: 13px; color: var(--dim); margin: 14px 0 6px; }
.fld-label:first-child { margin-top: 0; }
.name-row { display: flex; gap: 8px; }
#inp-company {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 12px;
  font-size: 16px;
  min-height: 44px;
}
#inp-company:focus { outline: none; border-color: var(--cyan); }

.direction-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dir-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dir-card:hover { border-color: #3b4d75; }
.dir-card.sel { border-color: var(--cyan); background: #14304a; box-shadow: 0 0 0 1px var(--cyan) inset; }
.dir-card .dir-head { font-weight: 700; margin-bottom: 4px; }
.dir-card .dir-desc { font-size: 12px; color: var(--dim); line-height: 1.45; }

.start-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.start-note { text-align: center; color: #5b6a82; font-size: 12px; margin-top: 12px; }

/* ---------- HUD ---------- */
.hud {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
  padding: 10px 14px;
  background: rgba(11, 15, 26, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.hud-left, .hud-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hud-company { font-weight: 800; font-size: 16px; }
.hud-pill {
  font-size: 12px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
  background: var(--card);
}
.hud-cash { font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.hud-cash.neg { color: var(--red); }
.hud-ap { color: var(--yellow); letter-spacing: 2px; font-size: 13px; }

/* ---------- 主布局 ---------- */
.game-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 12px;
  padding: 12px 14px 40px;
  max-width: 1180px;
  margin: 0 auto;
}
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.card-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.legend { font-size: 11px; color: var(--dim); font-weight: 400; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 10px; vertical-align: -1px; }
.lg-cash { background: var(--green); }
.lg-users { background: var(--blue); }
#chart { width: 100%; display: block; }

/* ---------- 数值面板 ---------- */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.stat { min-width: 0; }
.stat-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 3px; }
.stat-name { color: var(--dim); }
.stat-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 6px; background: var(--bg2); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; transition: width .4s; }
.stat-flat {
  grid-column: span 1;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
.stat-flat .stat-name { font-size: 12px; }
.stat-flat .stat-val { font-size: 15px; }
.staff-row {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 6px;
  border-top: 1px dashed var(--line);
  padding-top: 8px; margin-top: 2px;
}
.staff-chip {
  font-size: 12.5px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px;
}
.staff-chip b { color: var(--cyan); }

/* ---------- 友商 ---------- */
.rival-line { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.vs-bars { display: flex; flex-direction: column; gap: 6px; }
.vs-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); }
.vs-row .bar { flex: 1; }
.vs-row span { width: 74px; flex-shrink: 0; }
.vs-row i { font-style: normal; width: 40px; text-align: right; color: var(--text); font-weight: 700; }
.rival-note { font-size: 12px; color: var(--dim); margin-top: 8px; }

/* ---------- 行动 ---------- */
.ap-text { font-size: 12px; color: var(--yellow); font-weight: 400; }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer;
  min-height: 58px;
  transition: border-color .15s, background .15s, transform .08s;
}
.act-btn:hover:not(:disabled) { border-color: var(--cyan); background: #1c2a45; }
.act-btn:active:not(:disabled) { transform: scale(.97); }
.act-btn:disabled { opacity: .35; cursor: not-allowed; }
.act-name { font-weight: 700; font-size: 14px; }
.act-cost { font-size: 11.5px; color: var(--dim); }
.act-btn.special { border-color: #6d5aa8; background: #1e1a33; }
.btn-nextweek { width: 100%; margin-top: 10px; font-size: 16px; padding: 14px; }

/* ---------- 日志 ---------- */
.log-list { list-style: none; max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.log-list li {
  font-size: 12.5px;
  background: var(--bg2);
  border-left: 3px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  color: var(--dim);
  animation: slidein .25s;
}
@keyframes slidein { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; } }
.log-list li b { color: var(--text); font-weight: 600; }
.log-list li.good { border-left-color: var(--green); }
.log-list li.bad { border-left-color: var(--red); }
.log-list li.warn { border-left-color: var(--yellow); }
.log-list li.event { border-left-color: var(--purple); }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 7, 14, .78);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card);
  border: 1px solid #3b4d75;
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: pop .22s;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h2 { font-size: 19px; margin-bottom: 10px; }
.modal .modal-body { font-size: 14px; color: var(--text); margin-bottom: 16px; white-space: pre-line; }
.modal .modal-body .dim { color: var(--dim); font-size: 13px; }
.modal-btns { display: flex; flex-direction: column; gap: 8px; }
.modal-event-tag {
  display: inline-block; font-size: 11px; color: var(--purple);
  border: 1px solid var(--purple); border-radius: 999px; padding: 2px 9px; margin-bottom: 8px;
}
.hire-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px;
}
.hire-row .hr-info { font-size: 13px; min-width: 0; }
.hire-row .hr-info b { font-size: 14px; }
.hire-row .hr-info .dim { display: block; font-size: 11.5px; color: var(--dim); }
.hire-row .hr-btns { display: flex; gap: 6px; flex-shrink: 0; }
.hire-row .btn { padding: 8px 12px; min-height: 40px; font-size: 13px; }

/* 结局 */
.ending-grade { font-size: 13px; color: var(--yellow); margin-bottom: 8px; }
.ending-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin: 12px 0;
}
.ending-stats div { background: var(--bg2); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; color: var(--dim); }
.ending-stats b { display: block; color: var(--text); font-size: 15px; }

/* ---------- 手机适配 ---------- */
@media (max-width: 860px) {
  .game-grid { grid-template-columns: 1fr; padding: 10px 10px 60px; }
  .game-title { font-size: 27px; letter-spacing: 2px; }
  .hud { padding: 8px 10px; }
  .log-list { max-height: 220px; }
}
@media (max-width: 430px) {
  .direction-list { grid-template-columns: 1fr; }
  .actions-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  body { font-size: 14px; }
}
