:root {
  --bg: #100b07;
  --bg2: #1a120b;
  --ink: #efe3d0;
  --dim: #a89880;
  --gold: #d9a05b;
  --gold2: #f2c98a;
  --green: #7fa26b;
  --red: #b56a55;
  --panel: rgba(22, 15, 9, 0.88);
  --line: rgba(217, 160, 91, 0.22);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 800px at 60% 40%, var(--bg2), var(--bg) 70%);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
}
#globe { position: fixed; inset: 0; display: block; cursor: grab; }
#globe.dragging { cursor: grabbing; }

#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: linear-gradient(180deg, rgba(16,11,7,0.9), transparent);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .bean { color: var(--gold); font-size: 14px; }
.brand h1 { font-size: 20px; letter-spacing: 3px; font-weight: 600; }
.brand h1 em { font-size: 12px; letter-spacing: 1px; color: var(--dim); font-style: normal; margin-left: 8px; }
nav { display: flex; gap: 8px; }
.navbtn {
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 20px; cursor: pointer; font-size: 13px;
  transition: all .2s;
}
.navbtn:hover, .navbtn.active { background: var(--gold); color: #201408; border-color: var(--gold); }

#hint {
  position: fixed; bottom: 68px; left: 50%; transform: translateX(-50%);
  color: var(--dim); font-size: 12px; letter-spacing: 1px; z-index: 91;
  background: rgba(16,11,7,.6); padding: 6px 14px; border-radius: 14px;
}
#mapnote {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px;
  padding: 6px 12px 7px;
  font-size: 11.5px; line-height: 1.5; text-align: center;
  color: #c2ad8c;
  background: rgba(14,9,6,.94); border-top: 1px solid rgba(217,160,91,.3);
  backdrop-filter: blur(6px);
}
#mapnote .sep { color: rgba(217,160,91,.45); }
#mapnote b { color: var(--gold2); font-weight: 700; }
.worldbtn {
  background: var(--panel); color: var(--gold2); border: 1px solid rgba(217,160,91,.55);
  padding: 8px 14px; border-radius: 20px; cursor: pointer; font-size: 13px; transition: all .2s;
}
.worldbtn:hover { background: var(--gold); color: #201408; border-color: var(--gold); }
#mapnoteState { font-weight: 700; letter-spacing: .5px; }
#mapnoteBaidu { color: var(--gold2); font-weight: 700; }
#mapnoteState.demo { color: #b08d6a; }
#mapnoteState.off { color: #1a120a; background: var(--gold2); padding: 2px 9px; border-radius: 10px; }

.overlay {
  position: fixed; z-index: 30;
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
}
.hidden { display: none !important; }

/* country view：底图区改为绝对定位，避免隐藏 flex 兄弟仍占位把画布压成半屏 */
#countryView { inset: 0; position: fixed; }
.cv-head { padding: 18px 24px 6px; position: relative; z-index: 2; }
.cv-head h2 { font-size: 26px; color: var(--gold2); }
.cv-head p { color: var(--dim); font-size: 13px; margin-top: 4px; }
#cvBack {
  background: none; border: 1px solid var(--line); color: var(--ink);
  padding: 6px 12px; border-radius: 16px; cursor: pointer; margin-bottom: 8px;
}
#cvBack:hover { border-color: var(--gold); color: var(--gold); }
.cv-toggle {
  background: none; border: 1px solid var(--line); color: var(--dim);
  padding: 6px 12px; border-radius: 16px; cursor: pointer; margin-bottom: 8px; margin-left: 8px;
  font-size: 12px;
}
.cv-toggle:hover { border-color: var(--gold); color: var(--gold); }
.basemap-note { font-size: 11px; color: rgba(168,152,128,.75); margin-top: 6px; }
#cvOfficial {
  position: absolute; left: 0; right: 0; top: 118px;
  /* 容器必须有显式高度，否则绝对定位下会塌成 0 */
  height: calc(100% - 118px - var(--cm-strip-h, 56px));
  width: 100%;
}
#cvOfficial { background: #0d1218; }
#cvOfficial canvas { filter: sepia(.22) saturate(.72) brightness(.9) contrast(1.05); }
/* 容器已经按 --cm-strip-h 让开了底部状态栏，官方版权/审图号就贴在容器底边，绝不能遮 */
#cvOfficial .BMap_cpyCtrl, #cvOfficial .anchorBL { display: block !important; opacity: 1 !important; bottom: 2px !important; z-index: 95 !important; }
#cvOfficial .BMap_cpyCtrl { color: #d8c8ae !important; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
/* 产区标注层：自己定位，不交给 SDK 的 Label（实测它不会把标签摆到投影位置上） */
.cm-anno { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; overflow: hidden; }
.cm-pin {
  position: absolute; left: 0; top: 0; width: 8px; height: 8px; padding: 0;
  border-radius: 50%; border: 1px solid #f2c98a; background: #d9a05b;
  box-shadow: 0 0 6px rgba(217,160,91,.8); pointer-events: auto; cursor: pointer;
}
.cm-tag {
  position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: auto; cursor: pointer;
  color: #f2c98a; background: rgba(18,12,8,.82); border: 1px solid rgba(217,160,91,.6);
  padding: 2px 7px; font-size: 12px; line-height: 16px; border-radius: 10px;
  font-family: "Microsoft YaHei", sans-serif;
}
.cm-tag:hover { background: rgba(217,160,91,.28); color: #fff3dd; }
/* 铺不开的产区：收起名字但保留占位（宽度还要参与下一次避让），鼠标移到圆点上就亮出来 */
.cm-tag.cm-off { opacity: 0; pointer-events: none; }
.cm-pin:hover + .cm-tag.cm-off { opacity: 1; pointer-events: auto; }

/* region card — full detail sheet */
#regionCard {
  right: 22px; top: 64px; width: 380px; max-width: calc(100vw - 44px);
  max-height: calc(100vh - 64px - var(--cm-strip-h, 56px) - 14px);
  overflow-y: auto; border-radius: 14px; padding: 18px;
}
#regionCard h4 { color: var(--dim); font-size: 11.5px; letter-spacing: 1px; margin: 14px 0 5px; }
#regionCard p { font-size: 12px; line-height: 1.65; color: #d8c8ae; }
.x {
  position: absolute; top: 8px; right: 10px; background: none; border: none;
  color: var(--dim); font-size: 22px; cursor: pointer; z-index: 2;
}
.x:hover { color: var(--gold); }
#regionCard h3 { font-size: 19px; color: var(--gold2); padding-right: 24px; }
#regionCard .sub { color: var(--dim); font-size: 12px; margin: 2px 0 10px; }
.axisrow { display: grid; grid-template-columns: 46px 84px 1fr; gap: 6px; align-items: center; font-size: 10.5px; margin: 4px 0; }
.axisrow .alab { color: var(--gold2); }
.axisrow .abar { display: block; height: 4px; background: rgba(217,160,91,.15); border-radius: 2px; }
.axisrow .abar b { display: block; height: 100%; border-radius: 2px; background: var(--gold); }
.axisrow em { font-style: normal; color: var(--dim); line-height: 1.4; }
.rrow { display: flex; gap: 8px; font-size: 11.5px; padding: 5px 0; border-bottom: 1px dashed rgba(217,160,91,.15); }
.rrow span:first-child { color: var(--gold2); flex: 0 0 52px; }
.rrow span:last-child { color: #d8c8ae; }
.simrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.simbtn { font-size: 11.5px; padding: 5px 10px; border-radius: 14px; border: 1px solid var(--line); background: none; color: var(--ink); cursor: pointer; }
.simbtn:hover { border-color: var(--gold); color: var(--gold2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tags span {
  font-size: 11px; padding: 3px 9px; border-radius: 12px;
  background: rgba(217,160,91,.14); color: var(--gold2); border: 1px solid var(--line);
}
#rcTerroir { width: 100%; font-size: 12px; border-collapse: collapse; margin: 8px 0; }
#rcTerroir td, #msTable td { padding: 4px 2px; border-bottom: 1px dashed rgba(217,160,91,.15); vertical-align: top; }
#msTable { width: 100%; border-collapse: collapse; font-size: 11.5px; margin: 10px 0; }
#msMiniMap {
  position: relative; height: 220px; margin: 8px 0 10px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 10px; background: #0d0a07;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
#msMiniMap .BMap_cpyCtrl, #msMiniMap .anchorBL {
  display: block !important; opacity: 1 !important; z-index: 5 !important;
  position: absolute !important; bottom: 2px !important; background: rgba(14,9,6,.72) !important;
}
#msTable td:first-child { color: var(--gold2); white-space: nowrap; padding-right: 8px; }
#msTable td:last-child { color: #c8a97a; white-space: nowrap; }
#rcTerroir td:first-child { color: var(--dim); width: 66px; }
.note { font-size: 12.5px; line-height: 1.7; color: #d8c8ae; margin: 8px 0 12px; }
.rc-actions { display: flex; gap: 8px; }
.rc-actions button {
  flex: 1; padding: 9px 0; border-radius: 10px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--line); background: none; color: var(--ink);
}
#rcLike:hover { border-color: var(--gold); color: var(--gold2); }
#rcDislike:hover { border-color: var(--red); color: var(--red); }

/* right panel */
#panel { right: 0; top: 0; bottom: 0; width: 420px; max-width: 94vw; padding: 22px 22px calc(var(--cm-strip-h, 56px) + 16px); overflow-y: auto; border-radius: 18px 0 0 18px; }
#panel h3 { color: var(--gold2); font-size: 17px; margin-bottom: 6px; }
#panel h4 { color: var(--dim); font-size: 12px; margin: 14px 0 6px; letter-spacing: 1px; }
#panel .dim { font-size: 12.5px; color: var(--dim); line-height: 1.6; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 7px 12px; border-radius: 16px; border: 1px solid var(--line);
  background: none; color: var(--ink); font-size: 12.5px; cursor: pointer;
}
.chip small { color: var(--dim); }
.chip.sel { background: var(--gold); color: #201408; border-color: var(--gold); }
.chip.sel small { color: #4a3115; }
.big {
  width: 100%; margin: 12px 0; padding: 12px; font-size: 15px; letter-spacing: 4px;
  background: linear-gradient(135deg, var(--gold), #a86a32); color: #1d1207;
  border: none; border-radius: 12px; cursor: pointer;
}
.big:hover { filter: brightness(1.1); }
.big:disabled { opacity: .5; cursor: wait; }

.rescard {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px;
  display: flex; flex-direction: column; gap: 4px; cursor: pointer;
}
.rescard:hover { border-color: var(--gold); }
.rescard b { color: var(--gold2); font-size: 15px; }
.rescard .c { font-size: 11.5px; color: var(--dim); }
.rescard .t { font-size: 11.5px; color: #cbb392; }
.rankbar { height: 5px; border-radius: 3px; background: rgba(217,160,91,.15); margin-top: 6px; }
.rankbar i { display: block; height: 100%; border-radius: 3px; background: var(--gold); }

#diceStage { text-align: center; margin-top: 8px; min-height: 90px; }
#diceSpin { font-size: 30px; color: var(--gold2); font-weight: 600; }
#diceSub { color: var(--dim); font-size: 12px; margin-top: 6px; line-height: 1.7; }
#diceHistory ul { list-style: none; font-size: 12px; color: var(--dim); }
#diceHistory li { padding: 3px 0; border-bottom: 1px dashed rgba(217,160,91,.12); }

.apistatus { font-size: 12px; margin: 10px 0; padding: 8px 10px; border-radius: 8px; background: rgba(127,162,107,.12); color: var(--green); border: 1px solid rgba(127,162,107,.3); }
.apistatus.err { background: rgba(181,106,85,.12); color: var(--red); border-color: rgba(181,106,85,.4); }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: #d8c8ae; margin: 10px 0; cursor: pointer; }
.consent input { margin-top: 2px; accent-color: var(--gold); }
pre {
  background: #0b0704; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; font-size: 11px; overflow-x: auto; color: #cbb392; line-height: 1.7;
}
#uidOut { font-size: 12px; color: var(--gold2); }
#sommOut .rescard { cursor: default; }
.somm-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.somm-tags span { background: rgba(217,160,91,.16); color: var(--gold2); border-radius: 12px; padding: 3px 10px; font-size: 12px; }

@media (max-width: 720px) {
  #panel { width: 100%; border-radius: 0; }
  #regionCard { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; max-height: 55vh; }
  nav { flex-wrap: wrap; justify-content: flex-end; }
  .brand h1 em { display: none; }
}
