:root {
  --brand: #0e5fd6;
  --good: #15803d;
  --bad: #dc2626;
  --bg: #0f172a;
  --card: #ffffff;
  --line: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  overscroll-behavior: none;
}

#map { position: fixed; inset: 0; }

/* ---------------------------------------------------------------- 顶栏 */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  backdrop-filter: blur(6px);
  font-size: 13px;
  /* 必须高于地图上的定位按钮（.mapbtn z-index:22），否则菜单弹层会被它盖住 */
  z-index: 30;
}
#brand {
  /* logo 图片：比状态栏高，向下压出状态栏（但不能往上顶出屏幕，否则会被裁） */
  position: absolute;
  left: 6px; top: 1px;
  height: 56px; width: auto;
  z-index: 1;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}
#topbar { padding-left: 80px; }   /* 给 logo 留出位置，别压到金钱/骰子 chip */
/* 英文 logo（Éire Landlord）更宽更像徽章：给大一点点，同时限宽防压顶栏按钮 */
#brand.en { max-width: 46vw; }        /* 尺寸跟中文 logo 完全一致（56px） */
.login-logo.en { height: 150px; }
@media (min-width: 720px) {
  #brand { height: 66px; left: 8px; }
  /* 宽屏空间够，顶栏按钮别被 96px 截断（「🌐 语言：中文」要完整显示） */
  #topbar .chip.ghost { max-width: 220px; }
  #brand.en { max-width: 30vw; }        /* 桌面同样跟中文一致（66px） */
  #topbar { padding-left: 96px; }
  #topbar:has(#brand.en) { padding-left: 112px; }
}
.spacer { flex: 1; }
.chip {
  background: rgba(255, 255, 255, 0.14);
  border: 0;
  color: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
}
.chip.ghost { cursor: pointer; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { font-size: 16px; line-height: 1; padding: 4px 11px; position: relative; }
.menu-btn.alert::after {
  content: ""; position: absolute; top: 3px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%; background: #ef4444;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.92);
}
/* 汉堡菜单弹层 */
.menupop {
  position: absolute; top: 44px; right: 8px;
  min-width: 172px;
  background: #fff;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
  z-index: 32;
}
.menupop button {
  display: block; width: 100%;
  padding: 11px 12px;
  background: none; border: 0; border-radius: 8px;
  color: #0f172a; font-size: 14px; font-family: inherit;
  text-align: left; cursor: pointer; white-space: nowrap;
}
.menupop button:hover { background: #f1f5f9; }
.menupop button:active { background: #e2e8f0; }

/* ------------------------------------------------------------- 飘字提示 */
#toast {
  position: fixed;
  top: 52px; left: 50%;
  transform: translate(-50%, -12px);
  z-index: 40;
  max-width: 92vw;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.95);
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.good { background: rgba(22, 163, 74, 0.96); }
#toast.bad { background: rgba(220, 38, 38, 0.96); }
#toast.warn { background: rgba(217, 119, 6, 0.96); }
/* 通知类飘字：停留 8 秒，可点掉，宽一点好读 */
#toast.notify {
  background: rgba(30, 41, 59, 0.97);
  border-left: 4px solid #f59e0b;
  max-width: min(92vw, 520px);
  font-size: 13.5px;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;      /* 只有通知类飘字可点（点了就关），普通飘字仍然穿透 */
}

/* ------------------------------------------------------------- 底部面板 */
#panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 25;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.18);
  max-height: 62vh;
  display: flex;
  flex-direction: column;
}
/* 折叠把手：absolute 在抬头里（老爷：以前用 fixed + JS 算坐标，卡片一换高度它就到处跑） */
#panelToggle {
  position: absolute;
  right: 10px;
  top: 8px;
  z-index: 1;
  width: 46px; height: 28px;
  border: 0;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
#panelHead { position: relative; padding: 12px 64px 6px 14px; }
#where { font-size: 17px; font-weight: 700; }
#whereSub { font-size: 12px; color: var(--muted); margin-top: 3px; }
#panelBody { padding: 6px 14px 18px; overflow-y: auto; }
#panel.collapsed #panelBody { display: none; }

.row-title { font-size: 12px; color: var(--muted); margin: 10px 0 6px; font-weight: 600; }

/* 回到我的棋子（替代原来的定位按钮） */
.mapbtn {
  position: fixed;
  right: 10px;
  top: 58px;
  z-index: 22;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.mapbtn.hidden { display: none; }
.mapbtn:active { background: #eef2f7; }

/* 按钮 */
button.primary, button.secondary {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
}
button.primary { background: var(--brand); color: #fff; }
button.primary:disabled { background: #c7d2e5; cursor: default; }
button.primary.big { padding: 14px; font-size: 15px; }
button.primary.buy { background: var(--good); }
button.primary.rent { background: #0d9488; }
button.primary small, button.secondary small { font-weight: 500; font-size: 11.5px; opacity: 0.92; }
.stepbtn .yl { color: #0f766e; }
button.secondary { background: #f1f5f9; color: #334155; }
button.link {
  background: none; border: 0; color: var(--muted);
  font-size: 12.5px; text-decoration: underline; margin-top: 10px; cursor: pointer;
  font-family: inherit;
}

/* 方向按钮 */
.steps { display: flex; flex-direction: column; gap: 7px; }
.stepbtn {
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  gap: 1px 8px;
  align-items: center;
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 11px;
  cursor: pointer;
  font-family: inherit;
}
.stepbtn:active { background: #eef2f7; }
.stepbtn .dir {
  grid-row: span 2;
  font-size: 19px;
  text-align: center;
  color: var(--brand);
  font-weight: 700;
}
.stepbtn .nm { font-size: 14px; font-weight: 600; }
.stepbtn .meta { font-size: 11.5px; color: var(--muted); }
.stepbtn .own { font-weight: 600; }
.stepbtn .free { color: var(--good); }
.stepbtn .rent { color: var(--bad); margin-left: 4px; }

.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.prog { font-size: 12.5px; color: #7c3aed; margin-top: 8px; }
.stats { display: flex; gap: 16px; font-size: 13px; margin-top: 12px; color: #334155; }

#log { margin-top: 12px; }
.logrow {
  font-size: 12.5px;
  color: #334155;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.logrow .t { color: #9ca3af; margin-right: 5px; }
.logrow.rent_in, .logrow.block { color: var(--good); }
.logrow.rent_out, .logrow.broken { color: var(--bad); }

/* ---------------------------------------------------------------- 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.modal.hidden { display: none; }
/* 通用隐藏：任何元素加上 hidden 都必须真的看不见
   （踩过的坑：#paletteBox 用 class="palette hidden"，但只定义了 .modal.hidden，
     结果 class 加上了、面板照样显示，测试只查 class 存在也漏过去了） */
.hidden { display: none !important; }
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
}
.modal-box h1 { font-size: 20px; margin: 0 0 4px; }
/* 登录弹窗用 logo 代替标题：居中、比弹窗宽一点，向上顶出弹窗（老爷要求） */
.modal-box .login-logo-wrap {
  display: flex; justify-content: center; align-items: center;
  margin: -78px 0 10px;       /* 负上边距 = 让 logo 顶出弹窗顶边 */
}
.modal-box .login-logo {
  height: 150px; width: auto;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}
@media (max-width: 380px) {
  .modal-box .login-logo-wrap { margin: -64px 0 8px; }
  .modal-box .login-logo { height: 126px; }
}
/* 游客模式的「登录」按钮（顶栏）、登录弹窗里的「先随便逛逛」 */
.chip.login { background: #0e5fd6; color: #fff; border-color: #0e5fd6; font-weight: 600; }
.chip.login:hover { background: #0b4fae; }
.linkbtn {
  display: block; width: 100%; margin-top: 10px; padding: 8px 0;
  background: none; border: 0; color: #64748b; font-size: 12.5px;
  text-decoration: underline; cursor: pointer;
}
.linkbtn:hover { color: #334155; }
.modal-box h2 { font-size: 17px; margin: 0 0 10px; }
.modal-box .sub { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
.modal-box input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 8px;
  font-family: inherit;
}
.modal-box .msg { color: var(--bad); font-size: 12.5px; min-height: 16px; margin-top: 6px; }
.modal-box .tiny { font-size: 11px; color: #9ca3af; margin: 8px 0 0; }
.statline { font-size: 13.5px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
/* 「我的颜色」这一行：色值在左，「选颜色」按钮靠右（跟「退出登录」同款灰按钮） */
.statline.colorline { display: flex; align-items: center; gap: 8px; }
#btnPickColor {
  margin-left: auto; width: auto; display: inline-block;
  padding: 6px 12px; font-size: 12px; border-radius: 8px; border: 0;
  background: #f1f5f9; color: #334155;
  font-family: inherit; font-weight: 600; white-space: nowrap; cursor: pointer;
}
#btnPickColor:active { background: #e2e8f0; }

/* 抢购出价 */
.bidrow { display: flex; gap: 8px; margin-top: 8px; }
.bidrow input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
}
.bidrow button { width: auto; margin-top: 0; padding: 10px 18px; }

/* 我的产业列表 */
.assets-body { max-height: 62vh; overflow-y: auto; overflow-x: hidden; margin: 6px 0 12px; }
.asset-group { font-size: 12px; color: var(--muted); font-weight: 700; margin: 12px 0 6px; }
/* 每行两段式：上行「街名 …… 价格」，下行小字信息；只有交易按钮才另起一行
   —— 这样手机上永远不用左右移动 */
.asset-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  width: 100%;
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  margin-bottom: 6px;
  cursor: pointer;
  font-family: inherit;
  overflow: hidden;
}
.asset-item:active { background: #eef2f7; }
.asset-item .ai-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.asset-item .ai-top .an {
  font-size: 13.5px; font-weight: 700; color: #0f172a;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.asset-item .ai-top .ap { font-size: 12px; color: var(--muted); white-space: nowrap; }
.asset-item .ai-sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px;
  font-size: 11.5px; color: #64748b;
}
.asset-item .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.asset-item .an { flex: 1; font-size: 13.5px; font-weight: 600; }
.asset-item .ap { font-size: 12px; color: var(--muted); }
.asset-item .af { font-size: 11px; color: var(--good); }
.asset-item .awarn { font-size: 11px; color: var(--bad); font-weight: 700; }
.asset-item .ah { font-size: 11px; font-weight: 700; color: #92400e; }
.asset-item .abuild {
  font-size: 11.5px; font-weight: 700; color: #fff; background: #0f766e;
  padding: 5px 9px; border-radius: 8px; white-space: nowrap;
}
.asset-item .abuild:active { background: #0b5d57; }
.asset-item .asell { font-size: 11.5px; font-weight: 700; color: #b91c1c; background: #fee2e2; padding: 5px 9px; border-radius: 8px; white-space: nowrap; }
.asset-item .asell:active { background: #fecaca; }
.asset-item .alist { font-size: 11.5px; font-weight: 700; color: #fff; background: #7c3aed; padding: 5px 9px; border-radius: 8px; white-space: nowrap; }
.asset-item .alist.off { background: #ede9fe; color: #6d28d9; }
.asset-item .alist:active { filter: brightness(0.92); }
.asset-item .aring { font-size: 11px; font-weight: 700; color: #fff; background: #6d28d9; padding: 4px 8px; border-radius: 8px; white-space: nowrap; }
/* 账号面板里的取色器 / 自定义色板 */
.palette {
  margin-top: 8px; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 10px; background: #f8fafc;
}
.palette-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sw {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0;
}
.sw.on { box-shadow: 0 0 0 2px #0f172a; }
.palette-custom {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line);
}
.palette-custom .plabel { font-size: 12px; color: var(--muted); }
.palette-custom input[type="color"] {
  width: 40px; height: 30px; padding: 0; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; cursor: pointer;
}
.palette-custom input[type="text"] {
  width: 92px; padding: 6px 8px; font-size: 12.5px; border: 1px solid var(--line);
  border-radius: 7px; font-family: ui-monospace, Consolas, monospace; color: #0f172a;
}
.palette .phint { font-size: 11.5px; color: var(--muted); margin-top: 7px; }
button.mini {
  width: auto; font-size: 12px; padding: 6px 11px; border-radius: 7px;
  margin: 0; display: inline-block; font-family: inherit; font-weight: 600;
}
button.mini.primary { background: linear-gradient(180deg, #2b7fff, #0e5fd6); color: #fff; }
button.mini.ghost { background: #e2e8f0; color: #1e293b; }
button.sell { background: linear-gradient(180deg, #b91c1c, #991b1b); color: #fff; }
button.sell small { color: rgba(255, 255, 255, 0.88); }
button.build { background: linear-gradient(180deg, #0f766e, #0b5d57); color: #fff; }
button.build small { color: rgba(255, 255, 255, 0.88); }
.modal-box.wide { max-width: 420px; }
.logrow.offer_in, .logrow.seize_lost, .logrow.broken { color: var(--bad); }
.logrow.offer_out, .logrow.offer_blocked, .logrow.offer_failed { color: #7c3aed; }
.logrow.fortify { color: var(--good); }
.chip.alert { background: rgba(220, 38, 38, 0.9); color: #fff; }
/* 通知列表 */
.notify-item { font-size: 12.5px; padding: 7px 2px; border-bottom: 1px dashed var(--line); line-height: 1.5; }
.notify-item .nt { float: right; color: var(--muted); font-size: 11px; margin-left: 8px; }

/* 地图弹窗 */
.pop { font-size: 13px; min-width: 160px; }
.pop-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.pop-row { margin: 2px 0; }
.pop-row.tiny { color: #6b7280; font-size: 11.5px; }
/* 街卡里的玩家买卖（挂牌 / 报价） */
.pop-sect { margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line); }
.pop-sect:empty { display: none; }
.tr-title { font-size: 12px; font-weight: 700; color: #6d28d9; margin-bottom: 3px; }
.tr-row { margin: 2px 0; }
.tr-row.tiny { color: #6b7280; font-size: 11.5px; }
.mini {
  width: auto; margin-top: 0; margin-left: 6px; padding: 5px 10px;
  font-size: 12px; border-radius: 8px; background: #7c3aed; color: #fff;
  border: 0; font-family: inherit; font-weight: 600; cursor: pointer;
}
.mini.ghost { background: #ede9fe; color: #6d28d9; }
.mini:active { filter: brightness(0.92); }

.fatal {
  position: fixed; inset: auto 12px 12px 12px; z-index: 99;
  background: var(--bad); color: #fff; padding: 12px;
  border-radius: 10px; font-size: 13px;
}

@media (min-width: 720px) {
  #panel { left: 12px; right: auto; width: 380px; bottom: 12px; border-radius: 16px; max-height: 74vh; }
  #topbar { padding: 10px 14px; }
}

/* 手机：底部弹窗 → 左侧抽屉，宽度 60%（老爷要求：面积别那么大、位置挪到左边） */
@media (max-width: 719px) {
  #panel {
    left: 0; right: auto;
    top: auto; bottom: 0;                     /* 左下角（老爷要求） */
    width: min(60vw, 300px);
    max-height: 66vh;
    border-radius: 0 16px 0 0;
    box-shadow: 6px -8px 26px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease;
  }
  #panel.collapsed { transform: none; }                  /* 收起 = 往下缩成一行（不再滑出屏幕） */
  #panel.collapsed #panelBody { display: none; }
  #panel.collapsed #panelHead { padding-bottom: 10px; }
  #panel.collapsed #where { font-size: 15px; }
  #panelHead { padding: 14px 58px 6px 12px; }
  #where { font-size: 15.5px; line-height: 1.3; word-break: break-word; }
  #panelBody { padding: 4px 12px 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  /* 把手：absolute 在抬头里，永远贴卡片右上角（不再跟着卡片高度乱跑） */
  #panelToggle {
    width: 44px; height: 26px;
    font-size: 14px;
    right: 8px; top: 6px;
  }
}

/* ------------------------------------------------ 撒金币特效（纯 CSS，无素材） */
#fxLayer {
  position: fixed; inset: 0; z-index: 50; pointer-events: none; overflow: hidden;
}
.coin {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #fffbe0 0%, #ffe066 32%, #f2c032 62%, #a9761a 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6), 0 2px 6px rgba(80, 50, 0, 0.35);
  animation: coinFly 1.25s cubic-bezier(0.17, 0.72, 0.28, 1) forwards;
  animation-delay: var(--d, 0ms);
  will-change: transform, opacity;
}
/* 金币上的小方孔，一眼看出是金币 */
.coin::after {
  content: ""; position: absolute; inset: 34%; border-radius: 3px;
  background: rgba(120, 78, 10, 0.55);
}
@keyframes coinFly {
  0%   { transform: translate(0, 0) scale(0.35) rotate(0deg); opacity: 0; }
  12%  { opacity: 1; }
  62%  { opacity: 1; }
  100% { transform: translate(var(--tx, 0), calc(var(--ty, 0) + 170px)) scale(0.95) rotate(var(--r, 180deg)); opacity: 0; }
}
/* 一声"叮"的金光：从中心扩散一圈 */
.coinBurstRing {
  position: absolute; width: 70px; height: 70px; margin: -35px 0 0 -35px;
  border-radius: 50%; border: 3px solid rgba(255, 214, 82, 0.95);
  animation: coinRing 0.7s ease-out forwards;
}
@keyframes coinRing {
  0% { transform: scale(0.25); opacity: 0.95; }
  100% { transform: scale(3.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .coin, .coinBurstRing { display: none; }
}

/* --------------------------------------------------- 右下角的骰子（点一下=掷骰子） */
.dicewrap {
  position: fixed; right: 16px; bottom: 96px; z-index: 24;
  width: 52px; height: 52px;
}
.dicebtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  width: 52px; height: 52px; display: block;
  transition: transform .42s cubic-bezier(.22, 1.15, .36, 1);
  filter: drop-shadow(0 6px 10px rgba(15, 23, 42, .35));
}
.dicebtn.flying { transform: translate(var(--dx, 0), var(--dy, 0)) scale(2.3); z-index: 40; }
/* 弹出来的时候必须**完全不透明**（不能因为"本回合不能掷"的灰化样式而发虚） */
.dicebtn:disabled { cursor: default; }
.dicebtn:disabled:not(.flying) { filter: drop-shadow(0 6px 10px rgba(15,23,42,.2)) grayscale(.55); opacity: .75; }
.dicebtn.flying {
  opacity: 1;
  filter: drop-shadow(0 14px 22px rgba(15, 23, 42, .45));
}
.dicebtn.tap { animation: diceTap 1.4s ease-in-out infinite; }
@keyframes diceTap {
  0%, 100% { filter: drop-shadow(0 6px 10px rgba(15, 23, 42, .35)); }
  50% { filter: drop-shadow(0 2px 4px rgba(15, 23, 42, .28)) drop-shadow(0 0 10px rgba(250, 204, 21, .8)); }
}
.dicecount {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px;
  border-radius: 10px; background: var(--brand); color: #fff;
  font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center;
  padding: 0 5px; box-shadow: 0 2px 6px rgba(15, 23, 42, .3);
}
.dicecount.empty { background: #94a3b8; }

/* 立方体：6 个面 + 9 宫格点数，全 CSS 画（无图片素材） */
.dicewrap .cube {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transform: rotateX(0deg) rotateY(0deg);
  transition: transform .95s cubic-bezier(.25, .9, .3, 1);
}
.dicewrap .face {
  position: absolute; inset: 0; border-radius: 10px;
  background: linear-gradient(150deg, #ffffff, #eef2f7);
  border: 1px solid #cbd5e1;
  box-shadow: inset 0 0 9px rgba(15, 23, 42, .12);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 13%; gap: 6%; backface-visibility: hidden;
}
.dicewrap .pip { border-radius: 50%; background: #0f172a; box-shadow: inset 0 -1px 1px rgba(255,255,255,.3); }
.dicewrap .pip.off { background: transparent; box-shadow: none; }
.dicewrap .f1 { transform: translateZ(26px) scale(1.08); }
.dicewrap .f6 { transform: rotateY(180deg) translateZ(26px) scale(1.08); }
.dicewrap .f2 { transform: rotateY(90deg) translateZ(26px) scale(1.08); }
.dicewrap .f5 { transform: rotateY(-90deg) translateZ(26px) scale(1.08); }
.dicewrap .f3 { transform: rotateX(90deg) translateZ(26px) scale(1.08); }
.dicewrap .f4 { transform: rotateX(-90deg) translateZ(26px) scale(1.08); }
@media (min-width: 720px) {
  .dicewrap { bottom: 72px; }
}


/* 版权控件（OpenFreeMap / OpenStreetMap）：桌面保持底图原样（收起成 ⓘ，点开两行，无动画）
 * 手机：底图那条文字完全不显示（点 ⓘ 走我们自己的底部浮层） */
.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib.maplibregl-compact-show {
  max-width: 56vw;
  font-size: 10.5px;
}
.maplibregl-ctrl-attrib-inner {
  white-space: normal !important;
  word-break: break-word;
  line-height: 1.4;
  max-width: 56vw;
}
/* 版权控件：收起就是一颗 ⓘ 圆钮（24×24，背景透明、没白底方块），展开是同高的白条 —— 点开不跳 */
.maplibregl-ctrl-attrib.maplibregl-compact {
  background: transparent !important;      /* 关键：否则会有一层白底方块压在按钮下面 */
  padding: 0 !important;
  width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  border-radius: 50% !important;
  overflow: visible !important;
}
.maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show {
  display: flex !important;
  align-items: center;
  background: rgba(255, 255, 255, 0.92) !important;
  width: auto !important;
  padding: 0 24px 0 8px !important;        /* 右边留出 ⓘ 的位置 */
  border-radius: 12px !important;
}
.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {
  height: 24px !important;
  line-height: 24px;
  padding: 0;
  overflow: hidden;
}
/* 手机：底图那条版权文字一律不显示，而且容器也不许「展开成白条」——
 * 否则页面刚打开时 MapLibre 会先加一次 compact-show，出现「白色横条探出来再缩回去」 */
@media (max-width: 719px) {
  .maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-inner,
  .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {
    display: none !important;
  }
  .maplibregl-ctrl-attrib.maplibregl-compact,
  .maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show {
    width: 24px !important;
    min-width: 24px !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 50% !important;
    box-shadow: none !important;
  }
}

/* 版权浮层（手机）：底部弹出的小卡片，点空白处关闭 */
.credit-box { max-width: 420px; }
.credit-body { font-size: 13px; line-height: 1.7; color: var(--muted); margin: 4px 0 14px; }
.credit-body a { color: #0e5fd6; }
.credit-hint { font-size: 11.5px; color: #94a3b8; text-align: center; }
@media (max-width: 719px) {
  #creditModal { align-items: flex-end; padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  #creditModal .credit-box {
    width: 100%; max-width: none;
    border-radius: 16px 16px 12px 12px;
    padding-bottom: 14px;
  }
}
