/* ============ 小狗把炭掏 UI 样式（木质卡通风） ============ */
:root {
  --wood: #6b4a2f;
  --wood-dark: #4a3018;
  --cream: #f7ecd4;
  --cream-dark: #e8d8b4;
  --amber: #f6b23c;
  --amber-dark: #d98f1f;
  --green: #5d8f3a;
  --red: #c94f3d;
  --blue: #3f8fd2;
  --gold: #e8a23a;
}

#hud {
  position: absolute; left: 0; top: 0; right: 0;
  padding: 6px 8px 0;
  display: flex; flex-direction: column; gap: 4px;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }

#hud-top {
  display: flex; flex-direction: column; gap: 5px;
}
#hud-row1 {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
#hud-row2 {
  display: flex; gap: 7px;
  flex-wrap: wrap;
}
.pill {
  background: linear-gradient(180deg, #fff8e8, var(--cream));
  border: 2.5px solid var(--wood);
  border-radius: 20px;
  box-shadow: 0 2px 0 rgba(60,40,20,0.35);
  padding: 4px 12px;
  font-size: 14px; font-weight: bold; color: var(--wood-dark);
  white-space: nowrap;
}
/* 金币框：使用 jinbikuang2.png（已转 webp，保持宽高比，不拉伸） */
#goldBox {
  position: relative;
  min-width: 220px; height: 58px;
  flex-shrink: 0;
  display: flex; align-items: center;
  cursor: pointer;
}
#goldBox img.goldbox-bg {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
}
#goldVal {
  position: relative; z-index: 1;
  font-size: 18px; font-weight: 900;
  color: #f7e6b8;
  margin-left: 58px;
  margin-right: 50px;
  flex: 1; text-align: center; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(60,40,20,0.55);
}

#layerBox {
  flex: 1;
  margin-top: 2px;
  background: linear-gradient(180deg, rgba(255,248,232,0.95), rgba(247,236,212,0.95));
  border: 2.5px solid var(--wood);
  border-radius: 14px;
  box-shadow: 0 2px 0 rgba(60,40,20,0.35);
  padding: 3px 10px 6px;
  min-width: 0;
}
#layerName {
  font-size: 12px; font-weight: bold; color: var(--wood-dark);
  text-align: center; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#layerBar {
  height: 10px; background: #3a2a1a; border-radius: 6px;
  overflow: hidden; margin-top: 2px;
  border: 1.5px solid var(--wood-dark);
}
#layerFill {
  height: 100%; width: 0%;
  background: linear-gradient(180deg, #ffd76e, #f09a26);
  border-radius: 4px;
  transition: width 0.2s;
}
#layerNext { font-size: 9px; color: #8a6a42; text-align: center; }

.hud-btn {
  width: 40px; height: 40px;
  border: 2.5px solid var(--wood);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff3da, var(--cream-dark));
  box-shadow: 0 2.5px 0 rgba(60,40,20,0.4);
  font-size: 19px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  padding: 0;
  overflow: hidden;
}
.hud-btn img {
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.hud-btn.disabled {
  filter: grayscale(1) brightness(0.75);
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  border-color: #9a8a6a;
}
.hud-btn.disabled:active { transform: none; box-shadow: none; }
.hud-btn:not(.disabled):active { transform: translateY(2px); box-shadow: 0 0.5px 0 rgba(60,40,20,0.4); }
.hud-btn.hidden { display: none; }
.hud-btn .badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--red); color: #fff;
  border-radius: 10px; font-size: 10px; font-weight: bold;
  padding: 1px 5px; border: 1.5px solid #fff;
}

/* ---- 弹窗 ---- */
#modalRoot {
  position: absolute; inset: 0;
  display: none;
  background: rgba(30,20,10,0.45);
  z-index: 120;
  align-items: flex-start; justify-content: center;
  padding: 68px 14px 14px;
}
#modalRoot.show { display: flex; }

.panel {
  width: 100%; max-width: 400px; max-height: 96%;
  background: linear-gradient(180deg, #fdf6e6, var(--cream));
  border: 3.5px solid var(--wood);
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(50,32,16,0.45), 0 14px 40px rgba(0,0,0,0.35);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center;
  padding: 10px 12px 8px;
  border-bottom: 2.5px dashed rgba(107,74,47,0.35);
  gap: 8px;
}
.panel-title { font-size: 17px; font-weight: 900; color: var(--wood-dark); flex: 1; }
.panel-sub { font-size: 11px; color: #8a6a42; }
.panel-close {
  width: 30px; height: 30px; border-radius: 10px;
  border: 2px solid var(--wood);
  background: linear-gradient(180deg, #ffb08a, #f2836b);
  color: #fff; font-weight: bold; font-size: 15px;
  cursor: pointer; flex-shrink: 0;
}
.panel-body { padding: 10px 12px 14px; overflow-y: auto; overscroll-behavior: contain; }
.panel-body::-webkit-scrollbar { width: 5px; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(107,74,47,0.4); border-radius: 3px; }

.section-title {
  font-size: 12px; font-weight: bold; color: #8a6a42;
  margin: 8px 0 5px;
  display: flex; align-items: center; gap: 6px;
}
.section-title::after { content: ''; flex: 1; height: 1.5px; background: rgba(107,74,47,0.25); }

/* ---- 按钮 ---- */
.btn {
  border: 2px solid var(--wood-dark);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffd76e, var(--amber-dark));
  box-shadow: 0 2.5px 0 rgba(60,40,20,0.45);
  color: #4a3018; font-weight: bold;
  padding: 6px 12px; font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn:disabled {
  filter: grayscale(0.9); opacity: 0.6; cursor: default;
  transform: none; box-shadow: 0 2.5px 0 rgba(60,40,20,0.25);
}
.btn.green { background: linear-gradient(180deg, #a4d76e, #6da33c); color: #24400e; }
.btn.red { background: linear-gradient(180deg, #ff9a86, #d95343); color: #fff; }
.btn.blue { background: linear-gradient(180deg, #8ec8ff, #4a90d9); color: #10365c; }
.btn.small { padding: 3px 8px; font-size: 11px; border-radius: 8px; }
.btn.wide { width: 100%; padding: 9px; font-size: 14px; }

/* ---- 栏位格子 ---- */
.slot-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-chip {
  width: 76px; height: 58px;
  border: 2px solid var(--wood);
  border-radius: 10px;
  background: linear-gradient(180deg, #fff8e8, var(--cream-dark));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 10px; color: var(--wood-dark);
  cursor: pointer; position: relative;
  padding: 2px;
  text-align: center;
}
.slot-chip:active { filter: brightness(0.92); }
.slot-chip .dog-emoji { font-size: 20px; line-height: 1.1; }
.slot-chip .dog-name { font-weight: bold; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-chip .dog-stats { color: #8a6a42; font-size: 9px; }
.ren-link { margin-left: 4px; color: #4a8be0; cursor: pointer; pointer-events: auto; font-size: 10px; line-height: 1; }
.slot-chip.empty { border-style: dashed; opacity: 0.85; }
.slot-chip.locked { filter: grayscale(1); opacity: 0.55; cursor: default; }
.slot-chip .cost { color: #b06a00; font-weight: bold; font-size: 10px; }

/* ---- 升级行 ---- */
.up-row {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.55);
  border: 1.5px solid rgba(107,74,47,0.35);
  border-radius: 10px;
  padding: 6px 8px; margin-bottom: 6px;
}
.up-info { flex: 1; min-width: 0; }
.up-name { font-size: 13px; font-weight: bold; color: var(--wood-dark); }
.up-name .lv { color: #b06a00; font-size: 11px; margin-left: 4px; }
.up-desc { font-size: 10.5px; color: #7a5f3e; margin-top: 1px; }
.up-cost { font-size: 11px; font-weight: bold; color: #4a3018; white-space: nowrap; }

/* ---- 小狗行 ---- */
.dog-row {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.55);
  border: 1.5px solid rgba(107,74,47,0.35);
  border-radius: 10px;
  padding: 6px 8px; margin-bottom: 6px;
}
.dog-row .dog-emoji { font-size: 24px; }
.dog-mid { flex: 1; min-width: 0; }
.dog-title { font-size: 13px; font-weight: bold; color: var(--wood-dark); display: flex; align-items: center; gap: 5px; }
.job-tag {
  font-size: 9px; padding: 1px 6px; border-radius: 8px;
  background: #d9e8c4; color: #4a6a1a; border: 1px solid #a8c880;
}
.job-tag.idle { background: #eee4cc; color: #8a6a42; border-color: #c8b890; }
.stat-bars { display: flex; gap: 6px; margin-top: 2px; }
.stat-b { flex: 1; font-size: 9px; color: #7a5f3e; }
.stat-b .bar { height: 4px; background: #e0d0b0; border-radius: 2px; margin-top: 1px; overflow: hidden; }
.stat-b .bar i { display: block; height: 100%; border-radius: 2px; }

/* ---- 肉鸽卡 ---- */
#rogueRoot {
  position: absolute; inset: 0; z-index: 130;
  display: none;
  background: rgba(25,16,8,0.6);
  align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
  padding: 16px;
}
#rogueRoot.show { display: flex; }
.rogue-title {
  font-size: 20px; font-weight: 900; color: #ffe9b8;
  text-shadow: 0 2px 0 rgba(0,0,0,0.6);
  text-align: center;
}
.rogue-sub { font-size: 12px; color: #d8c8a8; margin-top: -4px; }
.rogue-cards { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 340px; }
.rogue-card {
  background: linear-gradient(180deg, #fff8e8, var(--cream));
  border: 3px solid var(--rc, #8a8a8a);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.35);
  display: flex; align-items: center; gap: 10px;
  animation: cardIn 0.25s ease-out backwards;
}
.rogue-card:nth-child(2) { animation-delay: 0.07s; }
.rogue-card:nth-child(3) { animation-delay: 0.14s; }
.rogue-card:nth-child(4) { animation-delay: 0.21s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } }
.rogue-card:active { transform: scale(0.97); }
.rogue-icon { font-size: 26px; }
.rogue-name { font-size: 14px; font-weight: 900; color: var(--rc); }
.rogue-rarity { font-size: 9px; color: #fff; background: var(--rc); border-radius: 6px; padding: 0 5px; margin-left: 5px; }
.rogue-desc { font-size: 11px; color: #6a5232; margin-top: 2px; }
.rogue-stack { font-size: 9px; color: #a08a62; margin-left: auto; white-space: nowrap; }

/* ---- toast ---- */
#toastRoot {
  position: absolute; top: 108px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  pointer-events: none; z-index: 140;
}
.toast {
  background: rgba(50,34,18,0.92);
  color: #ffe9b8; font-size: 12.5px; font-weight: bold;
  border: 1.5px solid rgba(255,220,150,0.4);
  border-radius: 20px;
  padding: 5px 16px;
  animation: toastIn 0.25s ease-out;
  max-width: 86%;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
.toast.fade { opacity: 0; transition: opacity 0.4s; }

/* ---- 标题页 ---- */
#titleScreen {
  position: absolute; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  overflow: hidden;
}
#titleScreen img.title-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
#titleScreen .title-inner {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
#titleLogo { width: 88%; max-width: 420px; filter: drop-shadow(0 6px 0 rgba(80,50,20,0.35)); }
#titleDog {
  width: 34%; max-width: 150px;
  filter: drop-shadow(0 5px 4px rgba(60,40,20,0.35));
  margin-top: -12px;
  animation: dogBob 2.4s ease-in-out infinite;
}
@keyframes dogBob { 50% { transform: translateY(-7px) rotate(-2deg); } }
#modeSel { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.mode-btn { width: 72%; max-width: 300px; cursor: pointer; filter: drop-shadow(0 5px 0 rgba(80,50,20,0.4)); transition: transform 0.15s; }
.mode-btn:active { transform: scale(0.96); }
#startBtn {
  width: 62%; max-width: 270px;
  cursor: pointer;
  filter: drop-shadow(0 5px 0 rgba(80,50,20,0.4));
  opacity: 0.45;
  transition: opacity 0.3s;
  animation: breathe 1.6s ease-in-out infinite;
}
#startBtn:active { transform: scale(0.96); }
#loadHint { color: #6a5232; font-size: 13px; font-weight: bold; text-shadow: 0 1px 0 rgba(255,255,255,0.6); }
#titleSettings { position: absolute; top: 12px; right: 12px; }

/* ---- 天赋 ---- */
.talent-row {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.55);
  border: 1.5px solid rgba(107,74,47,0.35);
  border-radius: 10px;
  padding: 6px 8px; margin-bottom: 6px;
}
.talent-name { font-size: 13px; font-weight: bold; color: var(--wood-dark); }
.talent-desc { font-size: 10.5px; color: #7a5f3e; }
.talent-lv { color: #b06a00; font-size: 11px; }

/* ---- 离线弹窗 ---- */
.offline-box { text-align: center; padding: 8px 4px 2px; }
.offline-gain { font-size: 30px; font-weight: 900; color: #c8860a; margin: 8px 0; }
.offline-sub { font-size: 12px; color: #7a5f3e; }

/* ---- 设置 ---- */
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.settings-label { font-size: 13px; font-weight: bold; color: var(--wood-dark); }
textarea.io-area {
  width: 100%; height: 64px;
  border: 1.5px solid var(--wood);
  border-radius: 8px;
  font-size: 10px;
  padding: 5px;
  box-sizing: border-box;
  resize: none;
  background: #fffdf6;
  font-family: monospace;
}
.hint-text { font-size: 11px; color: #8a6a42; margin: 4px 0 10px; line-height: 1.5; }

/* ---- 局外大厅 ---- */
#metaLobby {
  position: absolute; inset: 0; z-index: 110;
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
}
#metaLobby .title-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.75);
}
.lobby-box {
  position: relative;
  width: 84%; max-width: 340px;
  background: linear-gradient(180deg, #fdf6e6, var(--cream));
  border: 3.5px solid var(--wood);
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(50,32,16,0.45), 0 14px 40px rgba(0,0,0,0.4);
  padding: 16px;
  text-align: center;
  animation: cardIn 0.3s ease-out;
}
.lobby-title { font-size: 20px; font-weight: 900; color: var(--wood-dark); }
.lobby-sub { font-size: 13px; color: #6a5232; margin-top: 4px; }

.kv-row { display: flex; justify-content: space-between; font-size: 12.5px; color: #5a4326; padding: 3px 2px; }
.kv-row b { color: #4a3018; }
.divider { height: 1.5px; background: rgba(107,74,47,0.25); margin: 8px 0; }
