/* ============================================================
   CEO Simulator v3 — Rich Project System
   ============================================================ */

:root {
  --bg: #0a0e14; --bg2: #12161e; --bg3: #1a1f2b;
  --card: #161b25; --card-hover: #1c2230;
  --accent: #39ff14; --accent2: #00d4ff; --accent3: #ff6b6b;
  --gold: #ffd700; --orange: #ff8c00; --pink: #ff2d95;
  --text: #c8ccd4; --text2: #8b92a0; --text3: #5a6070;
  --border: #252b36; --radius: 10px; --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Helvetica Neue', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  min-height: -webkit-fill-available;
}
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.container { max-width: 480px; margin: 0 auto; padding: 12px; }

/* ── Auth ─────────────────────────────────────────────── */
.auth-box { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin: 16px 0; }
.auth-tabs { display: flex; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.auth-tab { flex: 1; padding: 10px; text-align: center; background: var(--bg3); border: none; color: var(--text2); font-size: 15px; cursor: pointer; transition: all 0.2s; font-family: inherit; font-weight: 600; }
.auth-tab.active { background: var(--accent2); color: #000; }
.auth-input { width: 100%; padding: 12px; margin-bottom: 8px; border-radius: var(--radius); background: var(--bg3); border: 1px solid var(--border); color: var(--text); font-size: 15px; font-family: inherit; -webkit-appearance: none; outline: none; }
.auth-input:focus { border-color: var(--accent2); }
.auth-error { color: var(--accent3); font-size: 13px; min-height: 20px; margin-bottom: 2px; }
.auth-hint { color: var(--text3); font-size: 12px; margin-top: 10px; }
.auth-user-badge { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; color: var(--accent2); font-size: 14px; }

/* ── Title ────────────────────────────────────────────── */
.title-screen {
  min-height: 100vh; min-height: -webkit-fill-available;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #0d1a2d 0%, var(--bg) 70%);
  padding: 20px;
}
.title-content { text-align: center; max-width: 400px; width: 100%; }
.game-title { font-size: clamp(28px, 8vw, 44px); font-weight: 900; background: linear-gradient(135deg, var(--accent2), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 8px; }
.subtitle { color: var(--text2); font-size: 15px; margin-bottom: 28px; }
.title-buttons { display: flex; gap: 10px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.title-features { color: var(--text3); font-size: 13px; line-height: 2; }

/* ── Buttons ──────────────────────────────────────────── */
button {
  background: var(--bg3); color: var(--text); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: var(--radius); cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 500;
  transition: all 0.15s; white-space: nowrap;
  -webkit-appearance: none; min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(0.97); }
button:hover { background: var(--card-hover); border-color: var(--accent2); color: #fff; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent2); color: #000; border-color: var(--accent2); font-weight: 700; }
.btn-primary:hover { background: #00e0ff; box-shadow: 0 0 20px rgba(0,212,255,0.3); }
.btn-secondary { background: transparent; border-color: var(--text3); }
.btn-danger { color: var(--accent3); border-color: var(--accent3); }
.btn-danger:hover { background: rgba(255,107,107,0.1); }
.btn-large { padding: 14px 28px; font-size: 16px; min-height: 48px; }
.btn-sm { padding: 6px 10px; font-size: 12px; min-height: 32px; }

/* ── Cards / Grid ─────────────────────────────────────── */
.card-grid { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px; cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.card:active { transform: scale(0.98); background: var(--card-hover); }
.card.selected { border-color: var(--accent); background: rgba(57,255,20,0.05); }
.card:hover { background: var(--card-hover); border-color: var(--accent2); }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; color: #fff; }
.card-desc { color: var(--text2); font-size: 13px; margin-bottom: 4px; }
.card-stat { color: var(--accent2); font-size: 12px; line-height: 1.6; }
.card-icon { font-size: 28px; margin-bottom: 4px; }

/* ── Project Picker Cards ─────────────────────────────── */
.project-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 14px; cursor: pointer; transition: all 0.15s;
  display: flex; gap: 12px; align-items: flex-start;
  -webkit-tap-highlight-color: transparent;
}
.project-card:active { transform: scale(0.98); background: var(--card-hover); }
.project-card:hover { border-color: var(--accent2); }
.project-card .pc-icon { font-size: 32px; flex-shrink: 0; width: 44px; text-align: center; }
.project-card .pc-info { flex: 1; min-width: 0; }
.project-card .pc-name { font-weight: 700; font-size: 15px; color: #fff; margin-bottom: 2px; }
.project-card .pc-desc { color: var(--text2); font-size: 12px; margin-bottom: 4px; }
.project-card .pc-stats { display: flex; gap: 12px; font-size: 12px; flex-wrap: wrap; }
.project-card .pc-stat { display: flex; align-items: center; gap: 3px; }
.pc-cost { color: var(--gold); }
.pc-time { color: var(--accent2); }
.pc-rev { color: var(--accent); }
.pc-risk-low { color: #4ade80; }
.pc-risk-medium { color: var(--orange); }
.pc-risk-high { color: var(--accent3); }
.pc-risk-veryhigh { color: var(--pink); }

/* ── Top Bar ──────────────────────────────────────────── */
.top-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-wrap: wrap; position: sticky; top: 0; z-index: 100; font-size: 13px;
}
.company-name { font-weight: 900; font-size: 14px; color: var(--accent); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cash-display { font-size: 14px; font-weight: 700; color: var(--gold); }
.top-stat { font-size: 11px; color: var(--text2); white-space: nowrap; }

/* ── Dashboard ────────────────────────────────────────── */
.dashboard-grid { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
@media (min-width: 768px) { .dashboard-grid { flex-direction: row; } .dashboard-grid > * { flex: 1; } }
.dash-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px; -webkit-overflow-scrolling: touch;
}
.dash-card h3 { font-size: 14px; color: var(--accent2); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* ── Project Items ────────────────────────────────────── */
.project-item { background: var(--bg3); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.proj-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.badge { font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 600; background: var(--bg3); color: var(--text2); }
.badge.active { background: rgba(0,212,255,0.15); color: var(--accent2); }
.badge.live { background: rgba(57,255,20,0.15); color: var(--accent); }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; margin: 6px 0; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 3px; transition: width 0.5s; }

/* ── Employee ─────────────────────────────────────────── */
.employee-card { background: var(--bg3); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.emp-header { display: flex; gap: 6px; align-items: center; margin-bottom: 3px; flex-wrap: wrap; }
.emp-stats { display: flex; gap: 12px; font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.emp-actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Hiring ───────────────────────────────────────────── */
.header-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.header-bar h2 { color: var(--accent2); font-size: 16px; margin-right: auto; }
.candidate-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; }
.cand-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.cand-info { color: var(--text2); font-size: 12px; margin-bottom: 5px; }
.cand-stats { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.stat-pill { font-size: 11px; background: rgba(0,212,255,0.1); color: var(--accent2); padding: 1px 5px; border-radius: 8px; }

/* ── Interview ────────────────────────────────────────── */
.interview-screen { padding: 12px; }
.interview-back { margin-bottom: 12px; }
.interviewee-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px; margin-bottom: 14px;
}
.interviewee-card h3 { color: var(--accent); font-size: 16px; margin-bottom: 4px; }
.interviewee-card .meta { color: var(--text2); font-size: 13px; }
.answer-bubble {
  background: var(--bg3); padding: 10px 12px; border-radius: var(--radius);
  border-left: 3px solid var(--accent2); font-style: italic; font-size: 14px; margin-top: 10px;
}
.impression { color: var(--gold); font-size: 13px; margin-top: 6px; }
.questions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.questions button { flex: 1; min-width: 120px; text-align: center; }
.salary-offer { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.salary-offer label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.salary-offer input[type=range] { width: 100%; margin: 8px 0; }
.salary-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.salary-row span { font-size: 18px; font-weight: 700; color: var(--gold); min-width: 80px; }
.interview-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { color: var(--text3); text-align: center; padding: 40px 0; font-size: 14px; }
.action-bar { margin-top: 16px; text-align: center; }

/* ── Time Bar ─────────────────────────────────────────── */
.time-bar { display: flex; gap: 8px; justify-content: center; padding: 12px 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); margin: 10px; }
.time-bar button { flex: 1; max-width: 100px; }

/* ── Event Log ────────────────────────────────────────── */
.event-log { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; margin: 10px; max-height: 240px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.event-log h3 { color: var(--accent2); margin-bottom: 6px; font-size: 14px; }
.log-entry { padding: 3px 0; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,0.03); display: flex; gap: 6px; }
.log-week { color: var(--text3); min-width: 32px; font-size: 11px; }

/* ── Kanban 看板 ────────────────────────────────────────── */
.kanban { display: flex; flex-direction: column; gap: 8px; padding: 10px; padding-top: 0; }
.kanban-card { display: flex; align-items: stretch; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.kanban-card.funding { border-color: rgba(255,215,0,0.3); background: linear-gradient(135deg,var(--bg2) 0%,rgba(255,215,0,0.05) 100%); }
.kanban-badge { min-width: 44px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: var(--bg3); border-right: 1px solid var(--border); }
.kanban-body { flex: 1; padding: 10px 12px; }
.kanban-body strong { font-size: 14px; color: var(--accent2); }
.kanban-desc { font-size: 12px; color: var(--text2); margin: 4px 0 8px; }
.kanban-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kanban-actions input[type="range"] { flex: 1; min-width: 80px; height: 6px; }
.kanban-actions .btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Origin Selection ──────────────────────────────────── */
.origin-grid { display: flex; flex-direction: column; gap: 10px; }
.origin-card { background: var(--bg2); border: 2px solid var(--border); border-radius: var(--radius-lg); padding: 16px; cursor: pointer; transition: all 0.2s; -webkit-tap-highlight-color: transparent; }
.origin-card:active { transform: scale(0.97); border-color: var(--accent); }
.origin-icon { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.origin-cash { font-size: 20px; font-weight: 800; margin: 6px 0; }
.origin-desc { font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.origin-perk { font-size: 12px; color: var(--accent2); background: var(--bg3); padding: 6px 10px; border-radius: var(--radius); margin-top: 8px; }

/* ── Loan Panel ────────────────────────────────────────── */
.loan-info-card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; margin-bottom: 10px; }
.loan-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 6px; }
.loan-form { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.loan-form select { margin-bottom: 8px; }

/* ── Meeting ───────────────────────────────────────────── */
.meeting-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }

/* ── HR Role Select ───────────────────────────────────── */
.hr-on { background: rgba(0,212,255,0.15) !important; border: 1px solid var(--accent2) !important; }

/* ── Forms ────────────────────────────────────────────── */
label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 3px; margin-top: 10px; }
input, select { background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 10px 12px; border-radius: var(--radius); font-family: inherit; font-size: 15px; width: 100%; outline: none; -webkit-appearance: none; }
input:focus { border-color: var(--accent2); }
input[type=range] { padding: 0; height: 4px; -webkit-appearance: none; background: var(--border); border: none; margin: 4px 0; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; background: var(--accent2); border-radius: 50%; cursor: pointer; }
hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.info-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.positive { color: var(--accent); }
.negative { color: var(--accent3); }

/* ── Dark Mode ──────────────────────────────────────────── */
body.dark { --bg: #0a0a0f; --bg2: #14141f; --bg3: #1e1e2e; --text: #e0e0e0; --text2: #a0a0b0; --text3: #606070; --border: #2a2a3a; }
body.dark .card, body.dark .loan-info-card, body.dark .loan-form, body.dark .dash-card { background: var(--bg2); }
body.dark .kanban-card { background: var(--bg2); }
body.dark .top-bar { background: rgba(10,10,15,0.95); }

/* ── Bottom Nav ─────────────────────────────────────────── */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around; background: var(--bg2); border-top: 1px solid var(--border); padding: 6px 0 env(safe-area-inset-bottom,8px); z-index: 100; }
.nav-btn { background: none; border: none; font-size: 22px; padding: 6px 12px; cursor: pointer; color: var(--text2); -webkit-tap-highlight-color: transparent; }
.nav-btn:active { color: var(--accent); transform: scale(0.9); }
#game { padding-bottom: 56px; }
#city3d { display: none; }

/* ── Legendary Project ──────────────────────────────────── */
.card[style*="border-color:var(--gold)"] { background: linear-gradient(135deg,var(--bg2),rgba(255,215,0,0.05)); }

/* ── Desktop 3D Split Layout ────────────────────────────── */
@media (min-width: 768px) {
  #game.show { display: flex !important; flex-direction: row !important; }
  #city3d { display: block; flex: 1; min-width: 0; height: 100vh; background: #0a0e14; }
  #city3d canvas { display: block; }
  #app { flex: 1; min-width: 360px; max-width: 520px; height: 100vh; overflow-y: auto; -webkit-overflow-scrolling: touch; border-left: 1px solid var(--border); }
  .bottom-nav { position: sticky; bottom: 0; }
  #game.show #app { padding-bottom: 0; }
  .container { max-width: 100%; }
  .dashboard-grid { flex-direction: column; }
}
