/* ============================================================
 * style.css — 开店模拟器样式（桌面 + 手机响应式）
 * ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #2b1d16;
  color: #fff;
  overscroll-behavior: none;
}

#app { max-width: 860px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }

.hidden { display: none !important; }
.screen { width: 100%; }

/* ---------------- 主菜单 ---------------- */
#menuScreen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 20%, #5d4037 0%, #2b1d16 75%);
  padding: 20px;
}
.menu-box {
  width: 100%; max-width: 520px;
  background: rgba(255, 248, 240, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  backdrop-filter: blur(4px);
}
.menu-box h1 { font-size: 34px; margin-bottom: 6px; text-shadow: 0 3px 8px rgba(0,0,0,0.5); }
.subtitle { color: #ffd54f; margin-bottom: 12px; }
.goal-hint {
  font-size: 13px; line-height: 1.7; color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.25); border-radius: 10px; padding: 8px 10px; margin-bottom: 16px;
}
#themeSelect { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.theme-card {
  background: rgba(255,255,255,0.07);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 12px 6px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  user-select: none;
}
.theme-card:hover { transform: translateY(-3px); }
.theme-card.picked { border-color: #ffd54f; background: rgba(255, 213, 79, 0.15); }
.theme-emoji { font-size: 34px; }
.theme-card b { font-size: 15px; }
.theme-card span { font-size: 11px; color: rgba(255,255,255,0.65); line-height: 1.3; }
#shopNameInput {
  width: 100%; padding: 12px 14px; margin-bottom: 14px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.3); color: #fff; font-size: 16px; text-align: center;
  outline: none;
}
#shopNameInput:focus { border-color: #ffd54f; }
.menu-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.menu-foot { margin-top: 14px; font-size: 12px; color: rgba(255,255,255,0.5); }

/* ---------------- 通用按钮 ---------------- */
.btn {
  border: none; border-radius: 10px;
  background: linear-gradient(180deg, #ffb300, #fb8c00);
  color: #3e2700; font-weight: 700; font-size: 14px;
  padding: 9px 16px; cursor: pointer;
  box-shadow: 0 3px 0 #b26a00;
  transition: transform 0.1s, filter 0.1s;
  user-select: none;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #b26a00; }
.btn:disabled { filter: grayscale(0.8) brightness(0.7); cursor: not-allowed; }
.btn.big { font-size: 17px; padding: 13px 26px; }
.btn.small { font-size: 13px; padding: 6px 12px; }
.btn.alt { background: linear-gradient(180deg, #66bb6a, #43a047); box-shadow: 0 3px 0 #2e7031; color: #08290a; }
.btn.gray { background: linear-gradient(180deg, #90a4ae, #607d8b); box-shadow: 0 3px 0 #455a64; color: #102027; }
.btn.warn-btn { background: linear-gradient(180deg, #ff7043, #f4511e); box-shadow: 0 3px 0 #bf360c; color: #fff; }
.btn.danger-btn { background: linear-gradient(180deg, #e57373, #e53935); box-shadow: 0 3px 0 #b71c1c; color: #fff; }
button.mini {
  border: none; border-radius: 6px; background: rgba(255,255,255,0.15); color: #ffd54f;
  font-size: 13px; font-weight: 700; padding: 3px 9px; margin: 0 2px; cursor: pointer;
}
button.mini:active { background: rgba(255,255,255,0.3); }

/* ---------------- 顶栏 HUD ---------------- */
#topBar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px;
  background: linear-gradient(180deg, #4e342e, #3e2723);
  border-bottom: 2px solid rgba(255, 213, 79, 0.4);
  position: sticky; top: 0; z-index: 20;
}
.hud-item {
  font-size: 14px; font-weight: 600;
  background: rgba(0,0,0,0.3); border-radius: 8px; padding: 5px 9px;
  white-space: nowrap;
}
.hud-item.name { color: #ffd54f; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.hud-item.money { color: #ffe082; }
.hud-item.money.neg { color: #ff8a80; }
.phase-btn {
  margin-left: auto;
  border: none; border-radius: 10px; font-weight: 700; font-size: 14px;
  padding: 8px 14px; cursor: pointer; color: #08290a;
  background: linear-gradient(180deg, #81c784, #4caf50);
  box-shadow: 0 3px 0 #2e7031;
  user-select: none;
}
.phase-btn.close { background: linear-gradient(180deg, #90caf9, #42a5f5); box-shadow: 0 3px 0 #1565c0; color: #0d2c4d; }
.phase-btn:active { transform: translateY(2px); }
.icon-btn {
  border: none; background: rgba(0,0,0,0.3); border-radius: 8px;
  font-size: 16px; padding: 6px 9px; cursor: pointer; color: #fff;
}

/* ---------------- 场景画布 ---------------- */
#canvasWrap {
  width: 100%;
  background: #1a120d;
  line-height: 0;
}
#scene {
  width: 100%; height: auto; display: block;
  touch-action: manipulation;
  cursor: pointer;
}

/* ---------------- 标签栏 ---------------- */
#tabBar {
  display: flex; overflow-x: auto;
  background: #3e2723;
  border-top: 1px solid rgba(255,255,255,0.1);
  scrollbar-width: none;
}
#tabBar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 1 0 auto; min-width: 72px;
  border: none; background: transparent; color: rgba(255,255,255,0.6);
  padding: 8px 4px 7px; font-size: 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border-bottom: 3px solid transparent;
  user-select: none;
}
.tab-btn .tab-emoji { font-size: 20px; }
.tab-btn.active { color: #ffd54f; border-bottom-color: #ffd54f; background: rgba(255, 213, 79, 0.08); }

/* ---------------- 面板 ---------------- */
#panel {
  background: #241a14;
  min-height: 220px; max-height: 46vh; overflow-y: auto;
  padding-bottom: 20px;
}
.panel-body { padding: 10px 12px; }
.panel-body h3 { font-size: 15px; color: #ffd54f; margin: 12px 0 8px; }
.hint { font-size: 12px; color: rgba(255,255,255,0.55); margin-bottom: 8px; line-height: 1.5; }
.muted { color: rgba(255,255,255,0.55); font-size: 12px; font-weight: 400; }
.good { color: #9ccc65; } .bad { color: #ff8a80; } .warn { color: #ffb74d; }
.price { color: #ffe082; }
.lack { color: #ff8a80; font-weight: 700; }
.dim { color: rgba(255,255,255,0.2); }

.card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.card.locked { opacity: 0.55; }
.card.danger { border-color: #ef5350; background: rgba(229, 57, 53, 0.12); }
.card.active-card { border-color: rgba(255, 213, 79, 0.5); }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.row { display: flex; align-items: center; gap: 6px; margin: 4px 0; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.gap { gap: 10px; }
.row.center { justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  font-size: 12px; background: rgba(0,0,0,0.35); border-radius: 20px;
  padding: 4px 10px; white-space: nowrap;
}

.bar {
  flex: 1; height: 10px; min-width: 90px;
  background: rgba(0,0,0,0.4); border-radius: 6px; overflow: hidden;
}
.bar-fill { height: 100%; background: linear-gradient(90deg, #81c784, #4caf50); border-radius: 6px; transition: width 0.3s; }
.bar-fill.gold { background: linear-gradient(90deg, #ffd54f, #ff8f00); }

.goal-card { border-color: rgba(255, 213, 79, 0.45); }
.goal-card > div { margin: 6px 0; font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stat {
  background: rgba(255,255,255,0.06); border-radius: 10px;
  padding: 10px 6px; text-align: center;
  display: flex; flex-direction: column; gap: 3px;
}
.stat b { font-size: 19px; color: #ffd54f; }
.stat span { font-size: 11px; color: rgba(255,255,255,0.6); }
#chartCanvas { width: 100%; height: auto; background: rgba(0,0,0,0.25); border-radius: 10px; }
.history { font-size: 13px; }
.hist-row { padding: 5px 8px; border-bottom: 1px dashed rgba(255,255,255,0.1); }

/* 成就 */
.ach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ach {
  display: flex; gap: 8px; align-items: flex-start;
  background: rgba(255,255,255,0.04); border-radius: 10px; padding: 8px;
  font-size: 12px; opacity: 0.65;
}
.ach.got { opacity: 1; background: rgba(255, 213, 79, 0.1); border: 1px solid rgba(255, 213, 79, 0.35); }
.ach-emoji { font-size: 22px; }

/* ---------------- 弹窗 ---------------- */
#modalRoot { position: fixed; inset: 0; z-index: 100; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal {
  width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto;
  background: linear-gradient(180deg, #4e342e, #33221b);
  border: 2px solid rgba(255, 213, 79, 0.5);
  border-radius: 18px;
  padding: 20px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.modal h2 { font-size: 21px; margin-bottom: 12px; text-align: center; color: #ffd54f; }
.modal h2.win { color: #ffd54f; text-shadow: 0 0 14px rgba(255, 213, 79, 0.6); }
.modal h2.lose { color: #ff8a80; }
.modal-text { font-size: 14px; line-height: 1.8; color: rgba(255,255,255,0.88); margin-bottom: 12px; }
.settle-grid {
  background: rgba(0,0,0,0.28); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 10px; font-size: 14px;
}
.settle-grid .row { padding: 3px 0; }
.settle-grid .total { border-top: 1px solid rgba(255,255,255,0.2); margin-top: 4px; padding-top: 7px; font-size: 15px; }
.settle-sub { font-size: 13px; color: rgba(255,255,255,0.8); margin-bottom: 10px; line-height: 1.7; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 10px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.25); }
.dot.on { background: #ffd54f; }

/* ---------------- Toast ---------------- */
#toastRoot {
  position: fixed; top: 54px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 6px; align-items: center;
  pointer-events: none; width: min(92vw, 480px);
}
.toast {
  background: rgba(30, 20, 14, 0.95);
  border: 1px solid rgba(255, 213, 79, 0.5);
  border-radius: 12px;
  padding: 9px 16px; font-size: 13px; text-align: center;
  opacity: 0; transform: translateY(-8px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 100%;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.warn { border-color: #ff8a65; color: #ffccbc; }
.toast.good { border-color: #9ccc65; color: #dcedc8; }
.toast.info { color: #ffe0b2; }

/* ---------------- 手机适配 ---------------- */
@media (max-width: 560px) {
  .menu-box h1 { font-size: 27px; }
  #themeSelect { grid-template-columns: repeat(2, 1fr); }
  .hud-item { font-size: 12px; padding: 4px 7px; }
  .hud-item.name { max-width: 90px; }
  .phase-btn { font-size: 12px; padding: 7px 10px; }
  #panel { max-height: 42vh; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .ach-grid { grid-template-columns: 1fr; }
  .tab-btn { min-width: 62px; }
}
@media (max-height: 700px) {
  #panel { max-height: 38vh; }
}
