/* 时光修复铺 · 样式：老街暖木色调 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { background: #241a13; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #3a2c20; font-size: 15px; line-height: 1.55;
}
#app {
  max-width: 440px; margin: 0 auto; min-height: 100vh;
  background: #f3e9d7; padding-bottom: 76px; position: relative;
}
.hidden { display: none !important; }

/* HUD */
#hud {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, #4a3421, #3c2a19);
  color: #f5e8cf; padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.hud-title { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.hud-lv { font-size: 12px; font-weight: 400; background: #a5713d; padding: 2px 8px; border-radius: 9px; margin-left: 4px; }
.hud-stats { display: flex; gap: 6px; align-items: center; }
.hud-chip { background: rgba(255,255,255,.12); padding: 3px 9px; border-radius: 11px; font-size: 13px; }
.hud-chip b { color: #ffd98a; }
.hud-btn { background: #a5713d; color: #fff; border: none; padding: 4px 11px; border-radius: 11px; font-size: 13px; cursor: pointer; }

/* 视图与导航 */
.view { display: none; padding: 12px 12px 4px; }
.view.active { display: block; }
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 440px; height: 62px; z-index: 20;
  background: #3c2a19; display: flex; box-shadow: 0 -2px 10px rgba(0,0,0,.3);
}
.tab {
  flex: 1; background: none; border: none; color: #c9b18c;
  font-size: 15px; cursor: pointer; letter-spacing: 2px;
}
.tab.active { color: #ffd98a; font-weight: 700; box-shadow: inset 0 3px 0 #ffd98a; }
.view-head { display: flex; justify-content: space-between; align-items: center; font-size: 17px; font-weight: 700; margin: 2px 2px 6px; }
.view-sub { font-size: 13px; font-weight: 400; color: #8a7358; }
.view-tip { font-size: 13px; color: #8a7358; margin: 0 2px 10px; }
.empty-tip { text-align: center; color: #a08b6d; padding: 34px 0; font-size: 14px; }

/* 卡片 */
.card {
  background: #fffaf0; border: 1px solid #e3d3b4; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(90,64,32,.08);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; color: #6b4a26; }
.shop-banner { position: relative; border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.shop-banner img { width: 100%; display: block; }
.shop-sign {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%);
  background: rgba(46,32,18,.85); color: #ffd98a; padding: 5px 18px;
  border: 1px solid #a5713d; border-radius: 6px; font-size: 16px; letter-spacing: 3px; white-space: nowrap;
}
.musicbox-card { display: flex; align-items: center; gap: 10px; }
.mb-icon { width: 58px; height: 58px; }
.mb-info { flex: 1; }
.mb-title { font-weight: 700; font-size: 15px; }
.mb-prog { font-size: 12px; color: #a5713d; font-weight: 400; margin-left: 4px; }
.mb-desc { font-size: 13px; color: #7d6750; margin-top: 2px; }

/* 按钮 */
.btn { border: none; border-radius: 9px; padding: 7px 14px; font-size: 14px; cursor: pointer; }
.btn-main { background: #b06f35; color: #fff; }
.btn-main:active { background: #96591f; }
.btn-sub { background: #7d8c5c; color: #fff; }
.btn-ghost { background: transparent; border: 1px solid #b39b74; color: #7a5c33; }
.btn:disabled { opacity: .45; }
.btn-big { width: 100%; padding: 13px; font-size: 17px; margin-top: 14px; }

/* 网格与物件卡 */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.item-card {
  background: #fffaf0; border: 2px solid #e3d3b4; border-radius: 12px;
  padding: 10px; text-align: center; cursor: pointer; position: relative;
}
.item-card img { width: 74px; height: 74px; }
.item-card .ic-name { font-weight: 700; font-size: 14px; margin-top: 2px; }
.item-card .ic-meta { font-size: 12px; color: #8a7358; }
.item-card .ic-price { font-size: 14px; color: #b06f35; font-weight: 700; margin-top: 2px; }
.item-card .ic-dmg { font-size: 11px; color: #a08b6d; margin-top: 2px; min-height: 28px; }
.rar-common { border-color: #d8c9a8; }
.rar-rare { border-color: #7fa3c7; box-shadow: 0 0 0 1px #7fa3c7 inset; }
.rar-legend { border-color: #e0aa3e; box-shadow: 0 0 10px rgba(224,170,62,.55); }
.rar-tag { position: absolute; top: 6px; right: 6px; font-size: 11px; padding: 1px 7px; border-radius: 8px; color: #fff; }
.rar-common .rar-tag { background: #a5936f; }
.rar-rare .rar-tag { background: #5b87ad; }
.rar-legend .rar-tag { background: #d29a26; }
.state-tag { position: absolute; top: 6px; left: 6px; font-size: 11px; padding: 1px 7px; border-radius: 8px; background: #7d8c5c; color: #fff; }

/* 图鉴 */
.gal-group-title { font-size: 15px; font-weight: 700; color: #6b4a26; margin: 12px 2px 8px; }
.item-card.locked { cursor: default; background: #e9dfca; }
.item-card.locked img { filter: brightness(0) opacity(.35); }
.item-card .ic-story-hint { font-size: 11px; color: #7d8c5c; }

/* 修复台 */
.overlay {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto;
  background: #f3e9d7; max-width: 440px; margin: 0 auto; padding: 14px;
}
.repair-head { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.repair-item { display: flex; gap: 12px; align-items: center; background: #fffaf0; border: 1px solid #e3d3b4; border-radius: 12px; padding: 12px; }
.repair-item img { width: 70px; height: 70px; }
.repair-name { font-size: 17px; font-weight: 700; }
.repair-dmg { font-size: 13px; color: #8a7358; margin-top: 3px; }
.repair-tip { margin: 18px 2px 10px; font-size: 14px; color: #6b5636; }
.gold-text { color: #d29a26; } .green-text { color: #5f7d3a; }
.wipe-zone {
  height: 130px; border-radius: 14px; border: 2px dashed #b39b74;
  background: repeating-linear-gradient(45deg, #efe2c6, #efe2c6 14px, #e9dab9 14px, #e9dab9 28px);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #8a6c42; letter-spacing: 4px; user-select: none; touch-action: none;
}
.wipe-zone:active { background: #eadfc2; }
.progress-wrap { height: 14px; background: #e0d0ac; border-radius: 7px; margin-top: 14px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #c98f3d, #e8bc66); transition: width .08s linear; }
.progress-text { text-align: center; font-size: 13px; color: #8a7358; margin-top: 6px; }
.timing-wrap { padding: 26px 4px 6px; }
.timing-bar { position: relative; height: 34px; background: #d9c9a4; border-radius: 8px; }
.timing-green { position: absolute; top: 0; height: 100%; background: #93b06a; border-radius: 0; }
.timing-gold { position: absolute; top: 0; height: 100%; background: #eec25e; }
.timing-pointer {
  position: absolute; top: -10px; width: 4px; height: 54px; background: #b03a2e;
  border-radius: 2px; box-shadow: 0 0 6px rgba(176,58,46,.6); left: 0%;
}
.result-badge { text-align: center; font-size: 26px; font-weight: 800; letter-spacing: 4px; margin-top: 26px; }
.result-badge.perfect { color: #d29a26; } .result-badge.good { color: #5f7d3a; } .result-badge.poor { color: #8a7358; }
.result-text { text-align: center; color: #6b5636; margin: 10px 8px 4px; }
.result-btns { display: flex; gap: 8px; margin-top: 18px; }
.result-btns .btn { flex: 1; padding: 11px 4px; }

/* 弹窗与 toast */
.mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(30,20,10,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fffaf0; border-radius: 14px; width: 100%; max-width: 380px;
  max-height: 82vh; overflow-y: auto; padding: 18px;
}
.modal-title { font-size: 17px; font-weight: 700; text-align: center; margin-bottom: 10px; color: #6b4a26; }
.modal-body { font-size: 14px; color: #4c3a26; white-space: pre-wrap; }
.modal-body img.modal-icon { width: 84px; height: 84px; display: block; margin: 4px auto 10px; }
.modal-btns { display: flex; gap: 8px; margin-top: 16px; }
.modal-btns .btn { flex: 1; padding: 10px 4px; }
.modal textarea {
  width: 100%; min-height: 76px; border: 1px solid #d8c9a8; border-radius: 8px;
  padding: 8px; font-size: 12px; margin-top: 8px; word-break: break-all; background: #fff;
}
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: rgba(46,32,18,.92); color: #ffe9bb; padding: 9px 18px; border-radius: 20px;
  font-size: 14px; z-index: 60; max-width: 88%; text-align: center;
}
.kv-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.kv-row span:first-child { color: #8a7358; }
.comm-done { color: #7d8c5c; font-weight: 700; }
.chapter-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed #e0d0ac; }
.chapter-row:last-child { border-bottom: none; }
.chapter-row .ch-name { font-size: 14px; }
.chapter-row .ch-state { font-size: 12px; color: #a08b6d; }
