/* style.css — 全局样式：布局 + 基础「代码框」按钮 + 主题变量
   职责：所有视觉都在这里。美术后期只改本文件与 res/，不动 JS。
   规则：只用代码画框，不用图片、不用图标。颜色一律走 :root 变量。 */

:root {
  /* 主题变量：换肤只改这一段 */
  --c-bg:      #F6F5F2;   /* 页面底色 */
  --c-panel:   #FFFFFF;   /* 面板底色 */
  --c-line:    #D3D1C7;   /* 框线 */
  --c-line-2:  #B4B2A9;   /* 框线（加强） */
  --c-text:    #2C2C2A;   /* 主文字 */
  --c-text-2:  #5F5E5A;   /* 次文字 */
  --c-up:      #A32D2D;   /* 上升（中式：红涨） */
  --c-down:    #0F6E56;   /* 下降（中式：绿跌） */
  --c-dead:    #B4B2A9;   /* 破产 / 退场 */
  --c-accent:  #185FA5;   /* 主色（星链） */
  --r: 8px;               /* 统一圆角 */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--c-bg);
  color: var(--c-text);
  font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px;
  /* 底部菜单栏是 fixed，留出它的高度 + 余量，别盖住内容 */
  padding-bottom: calc(56px + 20px);
  gap: 12px;
}

/* ---------- 顶栏：只居中放游戏名 ---------- */
.topbar {
  display: flex;
  justify-content: center;
  padding: 10px 12px;
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: var(--r);
}
.brand { font-weight: 500; }

/* ---------- 舞台 ---------- */
.stage { display: flex; flex-direction: column; gap: 12px; }

/* ---------- 街面：2×2 网格，4 家店铺满正方形 ---------- */
.street {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 8px;
  aspect-ratio: 1 / 1;   /* 街面是正方形 */
}

/* 顺时针 1–4：1 左上、2 右上、3 右下、4 左下（1 的邻居是 2 和 4） */
.street .shop[data-i="1"] { grid-area: 1 / 1; }
.street .shop[data-i="2"] { grid-area: 1 / 2; }
.street .shop[data-i="3"] { grid-area: 2 / 2; }
.street .shop[data-i="4"] { grid-area: 2 / 1; }

.shop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px;
  background: var(--c-panel);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r);
  font-size: 11px;
  line-height: 1.2;
  color: var(--c-text-2);
  overflow: hidden;
}
.shop .name { font-size: 15px; color: var(--c-text); text-align: center; white-space: nowrap; }
.shop .tag  { font-size: 11px; color: var(--c-line-2); letter-spacing: 1px; }
.shop.is-chain .tag { color: var(--c-accent); }
.shop.is-self { border-color: var(--c-accent); }
.shop.is-self .name { color: var(--c-accent); }
/* 选中的店铺：外描边，不挤动内容 */
.shop.is-active { outline: 2px solid var(--c-accent); outline-offset: -2px; background: #EAF2FA; }
.shop.is-dead { background: #EFEEEB; border-style: dashed; color: var(--c-dead); }
.shop.is-dead .name { color: var(--c-dead); text-decoration: line-through; }
.shop.is-dead .tag { color: var(--c-dead); }

/* ---------- 状态栏：街面下方独立一栏，分三格（信息 / 经营 / 好感） ---------- */
.board {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--c-panel);
  border: 1px dashed var(--c-line-2);
  border-radius: var(--r);
  overflow: hidden;
}
.cell-info { align-items: center; text-align: center; gap: 2px; }
.info-main { font-size: 14px; font-weight: 500; color: var(--c-text); }
.info-sub  { font-size: 12px; color: var(--c-text-2); }
.info-person { color: #c8991f; min-height: 14px; }

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  color: var(--c-text-2);
}
.metric-row b { font-size: 12px; font-weight: 500; color: var(--c-text); }

/* 数值条（默认空条） */
.bar {
  height: 8px;
  background: #EFEEEB;
  border: 1px solid var(--c-line);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--c-accent);
  border-radius: 3px;
  transition: width .2s;
}
.bar-fill.is-favor { background: #B8860B; }

/* ---------- 基础「代码框」按钮 ---------- */
.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.btn {
  padding: 14px 8px;
  background: var(--c-panel);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r);
  font: inherit;
  color: var(--c-text);
  cursor: pointer;
}
.btn:active { background: #EFEEEB; }
.btn-danger { border-color: var(--c-up); color: var(--c-up); }

/* 未选中店铺 / 不该用的动作：按钮置灰不可点 */
.btn:disabled,
.btn:disabled:active {
  background: #F1F0EC;
  border-color: var(--c-line);
  color: var(--c-dead);
  cursor: default;
}

/* ---------- 提示行：本回合发生了什么（紧邻按钮上方，点完就能看到） ---------- */
.tip {
  min-height: 46px;
  padding: 10px 12px;
  background: #EAF2FA;
  border: 1px solid var(--c-accent);
  border-radius: var(--r);
  font-size: 13px;
  line-height: 1.6;
  color: var(--c-text);
}
/* 内容更新时闪一下，提示玩家"这里有新反馈" */
.tip.flash { animation: tipFlash .6s ease-out; }
@keyframes tipFlash {
  0%   { background: #CFE3F7; }
  100% { background: #EAF2FA; }
}

/* ---------- 底栏 ---------- */
.bottom {
  margin-top: auto;
  padding: 8px 2px;
  font-size: 12px;
  color: var(--c-text-2);
}

/* ---------- 结算页 ---------- */
.result {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(44, 44, 42, 0.55);
}
.result[hidden] { display: none; }
.result-card {
  width: 100%;
  max-width: 320px;
  padding: 22px 20px;
  background: var(--c-panel);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r);
  text-align: center;
}
.result-card h2 { margin: 0 0 10px; font-size: 17px; font-weight: 500; }
.result-card p  { margin: 0 0 8px; font-size: 13px; color: var(--c-text-2); line-height: 1.7; }
.result-card .res-days { color: var(--c-text); }
.result-card .btn { width: 100%; margin-top: 12px; }
