/* 打工进化论 - 全局样式 v0.5 */
:root {
  --bg: #F5F0E8;
  --bg-pattern: repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(0,0,0,0.02) 24px, rgba(0,0,0,0.02) 25px);
  --primary: #1A1A2E;
  --accent: #E63946;
  --accent-light: #ff6b7a;
  --success: #2A9D8F;
  --success-light: #3dbdad;
  --warning: #E9C46A;
  --text: #333;
  --text-light: #888;
  --border: #e0ddd5;
  --card-bg: #fff;
  --card-hover: #fdfcfa;
  --shadow: 0 2px 12px rgba(26,26,46,0.06);
  --shadow-hover: 0 4px 20px rgba(26,26,46,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  background-image: var(--bg-pattern);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== 顶部状态栏 ===== */
.header {
  width: 100%;
  max-width: 800px;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--primary);
  background: linear-gradient(135deg, var(--card-bg) 0%, #f9f6f0 100%);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-name {
  font-weight: 700;
  font-size: 1.1em;
  color: var(--primary);
}

#job-title {
  color: var(--accent);
  font-size: 0.85em;
  font-weight: 600;
  background: rgba(230,57,70,0.08);
  padding: 2px 8px;
  border-radius: 10px;
}

.header-right { text-align: right; }

.header-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#cash-display {
  font-family: "Courier New", "SF Mono", monospace;
  font-size: 1.4em;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

#income-display {
  font-family: "Courier New", "SF Mono", monospace;
  font-size: 0.85em;
  color: var(--success);
  font-weight: 600;
}

/* ===== 进度条 ===== */
.progress-section {
  width: 100%;
  max-width: 800px;
  padding: 8px 20px 6px;
  background: var(--card-bg);
}

.progress-container {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}

#progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--success-light), var(--warning));
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 4px;
  position: relative;
}

#progress-bar::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

#stage-display {
  font-size: 0.75em;
  color: var(--text-light);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* ===== 主内容区 ===== */
.main-content {
  width: 100%;
  max-width: 800px;
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  flex: 1;
}

.left-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.right-panel {
  flex: 1.5;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== 角色区域 ===== */
.character-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px 20px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  border: 1px solid var(--border);
}

.character-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #2d2d5e);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2em;
  color: var(--bg);
  box-shadow: 0 4px 12px rgba(26,26,46,0.2);
}

#npc-bubble {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.78em;
  max-width: 220px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(26,26,46,0.2);
}

#npc-bubble.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

#npc-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  margin-left: -6px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--primary);
}

#work-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.1em;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(230,57,70,0.3);
  letter-spacing: 2px;
}

#work-btn:hover {
  box-shadow: 0 6px 20px rgba(230,57,70,0.4);
  transform: translateY(-1px);
}

#work-btn:active { transform: scale(0.96) translateY(1px); }

/* ===== 职业列表 ===== */
.job-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  flex: 1;
  overflow-y: auto;
  max-height: 450px;
  border: 1px solid var(--border);
}

.section-title {
  font-size: 0.85em;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.job-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.job-item:hover {
  background: var(--card-hover);
  border-color: var(--border);
}

.job-item.affordable {
  border-left: 3px solid var(--success);
  background: rgba(42,157,143,0.03);
}

.job-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.job-name { font-weight: 600; font-size: 0.9em; }

.job-level {
  font-size: 0.72em;
  color: var(--text-light);
  font-family: monospace;
}

.job-income {
  font-size: 0.8em;
  color: var(--success);
  font-family: "Courier New", monospace;
  font-weight: 600;
}

.upgrade-btn {
  padding: 7px 14px;
  background: linear-gradient(135deg, var(--success), var(--success-light));
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.78em;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(42,157,143,0.2);
}

.upgrade-btn:hover:not(.disabled) {
  box-shadow: 0 4px 12px rgba(42,157,143,0.3);
  transform: translateY(-1px);
}

.upgrade-btn.disabled {
  background: var(--border);
  color: var(--text-light);
  cursor: not-allowed;
  box-shadow: none;
}

/* ===== 底部导航 ===== */
.bottom-nav {
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: space-around;
  padding: 10px 20px;
  background: var(--card-bg);
  border-top: 2px solid var(--primary);
  position: sticky;
  bottom: 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.nav-btn {
  padding: 8px 20px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.nav-btn:hover {
  border-color: var(--primary);
  background: var(--bg);
}

.nav-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  background: rgba(230,57,70,0.05);
}

/* ===== 面板 ===== */
.panel { display: none; }
.panel.active { display: block; }

/* ===== 技能面板 ===== */
.skill-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.skill-name { flex: 1; font-weight: 500; font-size: 0.9em; }

.skill-value {
  font-family: "Courier New", monospace;
  font-size: 1.2em;
  font-weight: 700;
  color: var(--primary);
  width: 32px;
  text-align: center;
  background: var(--bg);
  border-radius: 4px;
  padding: 2px;
}

.skill-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  font-size: 1.1em;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
  box-shadow: 0 2px 6px rgba(230,57,70,0.2);
}

.skill-btn:hover { transform: scale(1.1); }

.skill-points-info {
  padding: 10px;
  background: linear-gradient(135deg, #fff3cd, #ffeaa7);
  border-radius: 6px;
  font-size: 0.85em;
  margin-bottom: 12px;
  text-align: center;
  font-weight: 600;
  border: 1px solid #f0d78e;
}

/* ===== 设置面板 ===== */
.settings-group {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.settings-label {
  display: block;
  font-size: 0.85em;
  color: var(--text-light);
  margin-bottom: 8px;
  font-weight: 500;
}

#panel-settings .lang-switcher {
  display: flex;
  gap: 8px;
}

#panel-settings .lang-btn {
  padding: 8px 18px;
  font-size: 0.85em;
  border-radius: 6px;
}

/* ===== 事件弹窗 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26,26,46,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active { display: flex; }

.modal-content {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 30px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 12px 40px rgba(26,26,46,0.25);
  animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

#event-title {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
}

#event-desc {
  font-size: 0.92em;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 20px;
}

#event-timer {
  font-size: 0.8em;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 12px;
  font-family: monospace;
}

.event-choice-btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  margin-bottom: 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  font-size: 0.92em;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.event-choice-btn:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow);
}

.choice-0 {
  border-color: var(--success);
  color: var(--success);
}

.choice-0:hover { background: rgba(42,157,143,0.05); }

.choice-1 {
  border-color: var(--accent);
  color: var(--accent);
}

.choice-1:hover { background: rgba(230,57,70,0.05); }

/* ===== 结局弹窗 ===== */
.ending-content { text-align: center; }

#ending-title {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 20px;
}

#ending-desc {
  font-size: 0.95em;
  line-height: 1.9;
  white-space: pre-line;
  margin-bottom: 24px;
  text-align: left;
}

#ending-epilogue {
  font-style: italic;
  color: var(--text-light);
  margin-bottom: 24px;
  font-size: 1.05em;
}

.ending-btn {
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(230,57,70,0.3);
  transition: all 0.2s;
}

.ending-btn:hover {
  box-shadow: 0 6px 20px rgba(230,57,70,0.4);
  transform: translateY(-1px);
}

/* ===== 离线收益弹窗 ===== */
.offline-content { text-align: center; }

#offline-income {
  font-family: "Courier New", monospace;
  font-size: 2.2em;
  color: var(--success);
  margin: 20px 0;
  font-weight: 700;
}

/* ===== 帮助按钮 ===== */
.help-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: none;
  font-size: 0.8em;
  font-weight: 700;
  cursor: pointer;
  color: var(--primary);
  transition: all 0.2s;
}

.help-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* ===== 帮助弹窗 ===== */
.help-content { text-align: left; }
.help-content h2 { margin-bottom: 16px; color: var(--primary); }
.help-content ul { padding-left: 20px; margin-bottom: 20px; }
.help-content li {
  margin-bottom: 10px;
  line-height: 1.6;
  font-size: 0.9em;
}

/* ===== 新手欢迎卡 ===== */
.welcome-content {
  text-align: center;
  cursor: pointer;
}

.welcome-title { font-size: 2.2em; margin-bottom: 16px; }

#welcome-text {
  font-size: 1.1em;
  line-height: 1.9;
  margin-bottom: 20px;
}

.welcome-hint {
  font-size: 0.8em;
  color: var(--text-light);
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== 引导气泡 ===== */
.tutorial-bubble {
  position: fixed;
  z-index: 1100;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85em;
  max-width: 240px;
  box-shadow: 0 4px 16px rgba(230,57,70,0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: bubblePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tutorial-bubble.hidden { display: none; }

.tutorial-bubble::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--accent);
}

.tutorial-bubble-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1em;
  cursor: pointer;
  opacity: 0.7;
  padding: 0 2px;
}

.tutorial-bubble-close:hover { opacity: 1; }

@keyframes bubblePop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== 语言切换按钮 ===== */
.lang-switcher { display: flex; gap: 2px; }

.lang-btn {
  padding: 4px 10px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 0.75em;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.lang-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== 飘字动效 ===== */
#floating-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.floating-text {
  position: absolute;
  font-family: "Courier New", monospace;
  font-weight: 700;
  animation: floatUp 1.5s ease-out forwards;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.floating-income { color: var(--success); font-size: 1.05em; }
.floating-negative { color: var(--accent); font-size: 1.05em; }

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { opacity: 0.8; transform: translateY(-20px) scale(1.05); }
  100% { opacity: 0; transform: translateY(-50px) scale(0.9); }
}

/* ===== 通知 ===== */
#notification-area {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification {
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85em;
  box-shadow: 0 4px 16px rgba(26,26,46,0.25);
  border-left: 3px solid var(--success);
}

.slide-in { animation: slideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.slide-out { animation: slideOut 0.3s ease forwards; }

@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { opacity: 1; } to { transform: translateX(120%); opacity: 0; } }

/* ===== 脉冲 & 抖动 ===== */
.pulse { animation: pulseAnim 0.3s ease; }
@keyframes pulseAnim { 50% { transform: scale(1.08); } }

.shake { animation: shakeAnim 0.5s ease; }
@keyframes shakeAnim {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ===== 事件日志 ===== */
.event-log-item {
  padding: 8px 0;
  font-size: 0.8em;
  color: var(--text-light);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  line-height: 1.5;
}

.event-log-item:last-child { border-bottom: none; }

/* ===== 滚动条美化 ===== */
.job-section::-webkit-scrollbar { width: 4px; }
.job-section::-webkit-scrollbar-track { background: transparent; }
.job-section::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
.job-section::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ===== 响应式 ===== */
@media (max-width: 600px) {
  .main-content { flex-direction: column; }
  .header { flex-direction: column; gap: 8px; text-align: center; }
  .header-right { text-align: center; }
  .header-top-row { justify-content: center; }
  .job-section { max-height: 350px; }
  .character-section { padding: 16px; }
  .character-avatar { width: 60px; height: 60px; font-size: 1.5em; }
  .modal-content { padding: 22px; }
}
