/*
 * 谷仓：页面布局。颜色、圆角、字体都用 css/themes.css 里每套主题定义的变量，这里不写死颜色。
 */
* { box-sizing: border-box; }
:root { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; }

#app { position: relative; max-width: 520px; height: 100%; margin: 0 auto; overflow: hidden; background: var(--bg); background-image: var(--paper, none); background-size: var(--paper-size, auto); }
.view { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 0 calc(env(safe-area-inset-bottom, 0px) + 96px); }

/* 顶部标题 */
.top { padding: 6px 18px 0; }
.top h1 { margin: 0; font-size: 24px; font-family: var(--title-font, inherit); letter-spacing: var(--title-spacing, 0); }
.top .sub { font-size: 12px; color: var(--soft); }

/* 本月花费卡 */
.sum { position: relative; margin: 12px 18px 0; padding: 14px 16px; border-radius: var(--r); background: var(--sum-bg); color: var(--sum-ink); box-shadow: var(--sum-shadow, none); border: var(--sum-border, 0); }
.sum .l { font-size: 12px; opacity: .85; }
.sum .v { font-size: 30px; font-weight: 800; line-height: 1.2; font-family: var(--num-font, inherit); }
.sum .m { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-top: 6px; opacity: .92; }
.meter { height: 8px; border-radius: 4px; background: var(--meter-bg); margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--meter); border-radius: 4px; transition: width .4s; }

.warnbar { margin: 10px 18px 0; padding: 9px 12px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-ink); font-size: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border: var(--warn-border, 0); }
.warnbar .acts { display: flex; gap: 10px; flex: 0 0 auto; }
.link { border: 0; background: none; padding: 0; font-weight: 700; color: var(--accent); }
.link.soft { color: var(--soft); font-weight: 400; }

/* 空状态 */
.empty { margin: 28px 18px 0; padding: 28px 16px; text-align: center; border-radius: var(--r); background: var(--card); border: var(--card-border, 0); box-shadow: var(--card-shadow, none); }
.empty-pile { display: flex; justify-content: center; margin-bottom: 10px; }
.empty-t { margin: 0; font-size: 16px; font-weight: 700; }
.empty-s { margin: 6px 0 0; font-size: 13px; color: var(--soft); }

/* 钱的摆放（GuMoney.html） */
.money { position: relative; height: 30px; transform-origin: left bottom; }
.money-fit { height: 30px; margin-left: auto; }
.money .n { position: absolute; width: 50px; height: 23px; border-radius: 2px; background-size: cover; box-shadow: 0 0 0 .5px rgba(0,0,0,.25), 1px 2px 3px rgba(0,0,0,.22); }
.money .c { position: absolute; width: 18px; height: 18px; border-radius: 50%; background-size: cover; box-shadow: 1px 1px 2px rgba(0,0,0,.28); }
.money .x { position: absolute; font-size: 10px; font-weight: 800; color: #fff; background: var(--x-bg); border-radius: 8px; padding: 0 5px; line-height: 15px; }

/* 「我的」页面板 */
.panel { position: relative; margin: 12px 18px 0; padding: 14px 16px; border-radius: var(--r); background: var(--card); border: var(--card-border, 0); box-shadow: var(--card-shadow, none); }
.panel h3 { margin: 0 0 10px; font-size: 15px; font-family: var(--title-font, inherit); }
.note { margin: 8px 0 0; font-size: 12px; color: var(--soft); }
.row-between { display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 700; }
.btns { display: flex; gap: 10px; margin-top: 10px; }
.btn { flex: 1; padding: 10px 14px; border-radius: 14px; border: 0; background: var(--accent); color: #fff; font-weight: 700; box-shadow: var(--btn-shadow, none); }
.btn { font-size: 14px; }
.btn.ghost { flex: 0 0 auto; padding: 6px 14px; background: transparent; color: var(--accent); border: 1.5px solid var(--accent); box-shadow: none; }
.btns .btn.ghost { flex: 1; }

.themes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.theme-card { display: flex; flex-direction: column; gap: 2px; padding: 8px; text-align: left; border-radius: calc(var(--r) - 6px); background: var(--bg); border: 2px solid transparent; }
.theme-card.on { border-color: var(--accent); }
.theme-card .tp { position: relative; height: 64px; border-radius: 10px; overflow: hidden; display: block; }
.theme-card .tp i { position: absolute; display: block; border-radius: 6px; }
.theme-card .tp i:nth-child(1) { left: 10%; top: 18%; width: 52%; height: 64%; }
.theme-card .tp i:nth-child(2) { right: 10%; bottom: 16%; width: 22%; height: 34%; border-radius: 50%; }
.theme-card .tp em { position: absolute; left: 16%; top: 26%; font-style: normal; font-weight: 800; font-size: 18px; }
.theme-card b { font-size: 13px; margin-top: 4px; }
.theme-card small { font-size: 11px; color: var(--soft); line-height: 1.35; }
.theme-card .tag-on { font-size: 11px; font-weight: 700; color: var(--accent); margin-top: 2px; }

.qr { text-align: center; }
.qr img { display: block; margin: 0 auto; border-radius: 10px; image-rendering: pixelated; background: #fff; }
.foot { margin: 16px 18px 0; text-align: center; font-size: 11px; color: var(--soft); }

/* 底部导航和加号 */
.tabbar { position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); height: 60px; border-radius: 24px; background: var(--tab-bg); display: flex; z-index: 5; box-shadow: var(--tab-shadow, none); border: var(--tab-border, 0); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 0; background: none; font-size: 11px; color: var(--soft); }
.tabbar button b { font-size: 17px; font-weight: 400; line-height: 1.1; }
.tabbar button.on { color: var(--tab-on); font-weight: 700; }
.fab { position: absolute; right: 22px; bottom: calc(env(safe-area-inset-bottom, 0px) + 86px); width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--fab); color: #fff; font-size: 30px; line-height: 1; z-index: 6; box-shadow: var(--fab-shadow); }
.fab:active { transform: translateY(2px); }

.toast { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 160px); transform: translateX(-50%); max-width: 86%; padding: 9px 16px; border-radius: 18px; background: rgba(40, 28, 36, .88); color: #fff; font-size: 13px; z-index: 20; text-align: center; }
