/* 弹窗通用样式（与主界面米纸细边框 100% 统一） */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(74, 53, 37, 0.44);
  backdrop-filter: blur(3px);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 20;
  touch-action: auto;
}

.modal-overlay.modal-global {
  position: fixed;
  inset: 0;
  z-index: 95;
  padding: max(12px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
}

.modal-overlay.show {
  display: flex;
}

.modal-card {
  background: var(--card-bg);
  border: 2.5px solid var(--border);
  border-radius: 22px;
  padding: 20px 18px 18px;
  width: 100%;
  max-width: 344px;
  text-align: center;
  box-shadow: 0 14px 38px rgba(74, 53, 37, 0.22);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.modal-card-wide {
  max-width: 540px;
  width: min(95vw, 540px);
  min-height: min(74dvh, 540px);
  max-height: min(88dvh, 700px);
  padding: 20px 20px 18px;
  gap: 8px;
}

.modal-card-daily {
  max-width: 440px;
  width: min(94vw, 440px);
  max-height: min(88dvh, 620px);
  overflow-y: auto;
  touch-action: pan-y;
  padding: 22px 20px 20px;
}

.modal-card-shop {
  max-width: 460px;
  width: min(94vw, 460px);
  max-height: min(88dvh, 680px);
  overflow-y: auto;
  touch-action: pan-y;
  padding: 20px 18px;
  gap: 8px;
}

.festive-header-badge {
  display: inline-block;
  background: var(--festive-red-soft);
  color: var(--festive-red);
  border: 1.5px solid rgba(212, 63, 51, 0.28);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 11px;
  border-radius: 99px;
  letter-spacing: 0.5px;
}
.festive-header-badge.is-daily-won {
  background: #e8f8df;
  color: #246617;
  border-color: #68b04c;
  font-size: 12px;
  padding: 4px 13px;
}
.festive-header-badge.is-daily-fail {
  background: #ffe6e3;
  color: #bf2d20;
  border-color: #df7a70;
  font-size: 12px;
  padding: 4px 13px;
}

.modal-title {
  font-size: 17px;
  font-weight: 900;
  margin: 0;
  color: var(--ink);
}

.reward-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.reward-canvas-wrap {
  width: 112px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#rewardCanvas {
  width: 112px;
  height: 112px;
  display: block;
}

.reward-rank-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--ink);
  margin: 0;
}

.modal-blessing {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.5;
  max-width: 260px;
}

/* 极简积分展示 */
.score-summary {
  width: 100%;
  background: #faf3e6;
  border: 1.5px solid #ebdac0;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.score-big {
  font-size: 28px;
  font-weight: 900;
  color: var(--orange-deep);
  line-height: 1.1;
}

.score-meta {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
}

/* 极简图鉴圆点条 */
.dex-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}

.dex-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dex-badge-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #5c3c24;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  color: #4a3525;
  transition: transform 0.15s;
}

.dex-badge-dot.locked {
  background: #ece3d4 !important;
  border-color: #cbbba5;
  color: #a89782;
  border-style: dashed;
}

.dex-badge-dot.current {
  transform: scale(1.18);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--festive-red);
}

.btn-group {
  width: 100%;
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.btn-primary {
  flex: 1.2;
  border: 2px solid #c95e0c;
  border-radius: 13px;
  padding: 10px 10px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--orange);
  cursor: pointer;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-arena {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 13px;
  padding: 10px 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: #fff8ec;
  cursor: pointer;
}

.btn-arena:active {
  transform: scale(0.97);
}

/* 排行榜弹窗 */
.rank-pane {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dex-pane,
.ach-pane {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  touch-action: pan-y;
  padding-right: 2px;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 4px 0 10px;
  flex: 1 1 auto;
  min-height: 220px;
  overflow-y: auto;
  touch-action: pan-y;
  padding-right: 2px;
}

.rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #faf1e2;
  border-radius: 13px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 700;
}

.rank-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e5d2b8;
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 900;
  flex-shrink: 0;
}

.rank-item:nth-child(1) .rank-num { background: #ffcf40; color: #7a4b00; }
.rank-item:nth-child(2) .rank-num { background: #d9dde2; color: #47505a; }
.rank-item:nth-child(3) .rank-num { background: #e8a87c; color: #6b3410; }

.name-input-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  background: #faf3e6;
  border: 1.5px solid #e6d2b5;
  border-radius: 12px;
  padding: 5px 7px 5px 11px;
}

.name-input-label {
  font-size: 11.5px;
  font-weight: 900;
  color: var(--ink-soft);
  white-space: nowrap;
}

.name-input {
  flex: 1;
  min-width: 0;
  border: 1.8px solid var(--border);
  border-radius: 9px;
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.name-input:focus {
  border-color: var(--orange);
}

.name-save-btn {
  border: 1.6px solid #c95e0c;
  background: var(--orange);
  color: #fff;
  border-radius: 9px;
  padding: 5px 11px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.name-save-btn:active {
  transform: scale(0.96);
}

.close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: #f0e4d2;
  color: var(--ink);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 900;
  cursor: pointer;
}
.lang-btn {
  width: auto;
  height: 24px;
  padding: 0 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 900;
  color: var(--ink-soft);
  letter-spacing: 0.3px;
  margin-left: auto;
  flex-shrink: 0;
}

.btn-revive {
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 2px solid #e0a01c;
  background: #fff4cc;
  color: #9c5600;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  display: none;
}
.btn-revive.show { display: block; }
.btn-revive:active { transform: scale(0.97); }


.shop-section-title {
  font-size: 12px;
  font-weight: 900;
  color: var(--ink-soft);
  text-align: left;
  margin: 10px 0 6px;
}
.shop-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
#shopThemesGrid {
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.shop-item {
  width: 100%;
  background: #faf3e6;
  border: 2px solid #ebdac0;
  border-radius: 13px;
  padding: 7px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: inherit;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.shop-item:hover { border-color: #d9a066; background: #fff9ee; }
.shop-item:active { transform: scale(0.96); }
.shop-item.equipped {
  border-color: #e06d14;
  background: #fff3de;
}
.shop-item.locked { opacity: 0.92; }
@keyframes shopShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.shop-item.shake { animation: shopShake 0.24s ease; border-color: #d94336; }
.shop-tip {
  min-height: 18px;
  font-size: 11.5px;
  font-weight: 800;
  color: #c9472b;
  margin: 2px 0 4px;
  text-align: center;
}
.coin-pill-btn {
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.coin-pill-btn:hover { background: #ffe9a8; transform: translateY(-1px); }
.coin-pill-btn:active { transform: scale(0.95); }
.shop-swatch {
  width: 36px;
  height: 22px;
  border-radius: 8px;
  border: 2px solid #5c3c24;
}
.shop-name { font-size: 12px; font-weight: 900; color: var(--ink); }
.shop-price { font-size: 11px; font-weight: 800; color: #b86800; }

.modal-tabs {
  display: flex;
  gap: 6px;
  margin: 4px 28px 10px 0;
}
.modal-tab {
  flex: 1;
  border: 1.6px solid var(--border);
  background: #f5ebd9;
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
}
.modal-tab.active {
  background: #d43f33;
  border-color: #b52b20;
  color: #fff9ec;
}
.ach-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 2px;
  text-align: left;
}
.ach-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 13px;
  border: 1.6px solid #e0d6c6;
  background: #f4efe6;
}
.ach-card.done-bronze { background: #fff5eb; border-color: #d99962; }
.ach-card.done-silver { background: #f2f7ff; border-color: #8faac7; }
.ach-card.done-gold   { background: #fff8db; border-color: #e0a01c; }
.ach-card canvas { width: 38px; height: 42px; flex-shrink: 0; }
.ach-name { font-size: 12px; font-weight: 900; color: var(--ink); line-height: 1.25; }
.ach-card:not(.done) .ach-name { color: #9c8d7a; }
.ach-desc { font-size: 10.5px; font-weight: 700; color: var(--ink-soft); line-height: 1.3; margin-top: 2px; }

.daily-rule-box {
  background: #faf3e6;
  border: 1.8px solid #ebdac0;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 8px 0 10px;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.58;
  color: var(--ink);
}

.dex-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  padding: 2px;
}
.dex-card {
  position: relative;
  background: #faf3e6;
  border: 1.6px solid #e5d2b8;
  border-radius: 14px;
  padding: 10px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.dex-card.locked {
  background: #f2ece1;
  border-color: #dfd4c3;
  border-style: dashed;
}
.dex-card canvas {
  width: 54px;
  height: 54px;
  display: block;
}
.dex-card-q {
  width: 48px;
  height: 48px;
  margin: 3px 0;
  border-radius: 50%;
  background: #e5dccb;
  color: #9e8d78;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 900;
}
.dex-card-name {
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.2;
}
.dex-card.locked .dex-card-name { color: #9c8d7a; }
.dex-card-meta {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-soft);
}
.fortune-rank-pill {
  margin-top: 2px;
  padding: 3px 10px;
  border-radius: 99px;
  background: #fff6de;
  border: 1.4px solid #e6c26c;
  color: #9c5600;
  font-size: 11px;
  font-weight: 800;
}
.fortune-rank-pill.is-daily-won {
  background: #eef9e6;
  border-color: #7ac05e;
  color: #266919;
}
.fortune-rank-pill.is-daily-fail {
  background: #fff0ed;
  border-color: #e58d82;
  color: #c43528;
}

/* 全球实时排行榜子标签、地区胶囊与残局口令按钮 */
.board-subtabs {
  display: flex;
  gap: 5px;
  width: 100%;
  background: #f3e8d6;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 8px;
}
.board-subtab {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 4px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}
.board-subtab:hover {
  color: var(--ink);
}
.board-subtab.active {
  background: #fffdf8;
  color: var(--orange-deep);
  box-shadow: 0 1px 4px rgba(138, 92, 42, 0.14);
}

.rank-daily-diff-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.rank-diff-pill {
  flex: 1;
  border: 1.6px solid #e2cbb0;
  background: #faf3e6;
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.rank-diff-pill.active {
  background: #eef9e6;
  border-color: #6db34f;
  color: #2f6b20;
}

.rank-meta-strip {
  width: 100%;
  padding: 6px 11px;
  margin-bottom: 6px;
  border-radius: 11px;
  background: #fff6e0;
  border: 1.4px solid #ebd098;
  color: #8a4b08;
  font-size: 11.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.35;
}

.rank-meta-text {
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nick-edit-chip {
  border: 1.3px solid #dec18d;
  background: #fffdf6;
  color: #7a460b;
  border-radius: 99px;
  padding: 2px 9px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.nick-edit-chip:hover {
  border-color: var(--orange);
  color: var(--orange-deep);
}

.rank-item.is-me {
  background: #fff3d6;
  border: 1.5px solid #e6b85c;
}

.country-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 19px;
  padding: 0 5px;
  border-radius: 6px;
  background: #efe2cd;
  border: 1px solid #d8c2a3;
  color: #5c422c;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.rank-cat-mini {
  width: 24px;
  height: 24px;
  display: block;
  flex-shrink: 0;
}

.rank-name-text {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 800;
}

.online-rank-pill {
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: #fff3dc;
  border: 1.4px solid #e5bd73;
  color: #9c5206;
  font-size: 11px;
  font-weight: 800;
}

.btn-daily-copy {
  width: 100%;
  margin-bottom: 8px;
  padding: 9px 12px;
  border-radius: 13px;
  border: 2px solid #5e9c49;
  background: #eef9e6;
  color: #2b631b;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
}
.btn-daily-copy:active {
  transform: scale(0.97);
}

/* 云端自动存档与跨设备通行码卡片（仅在「我的」面板展示，扁平手绘米纸风） */
.cloud-sync-card {
  width: 100%;
  background: #fff7e6;
  border: 1.6px solid #e6c999;
  border-radius: 13px;
  padding: 9px 11px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
}

.cloud-sync-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cloud-sync-title {
  font-size: 11.5px;
  font-weight: 900;
  color: #6e4516;
}

.cloud-code-pill {
  font-size: 11px;
  font-weight: 800;
  color: #8a5618;
  background: #fffdf7;
  border: 1.3px solid #e2c18a;
  border-radius: 8px;
  padding: 2px 8px;
  letter-spacing: 0.4px;
}

.cloud-code-pill b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  color: #b85306;
  font-weight: 900;
}

.cloud-sync-actions {
  display: flex;
  gap: 6px;
  width: 100%;
}

.cloud-act-btn {
  flex: 1;
  min-width: 0;
  border: 1.5px solid #dec092;
  background: #fffdf8;
  color: var(--ink);
  border-radius: 9px;
  padding: 6px 6px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s, background 0.15s;
}

.cloud-act-btn:hover,
.cloud-act-btn.active {
  border-color: var(--orange);
  background: #fff4df;
  color: var(--orange-deep);
}

.cloud-qr-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: #fffdf8;
  border: 1.4px dashed #dec398;
  border-radius: 11px;
}

.cloud-qr-canvas {
  width: 156px;
  height: 156px;
  border-radius: 8px;
  border: 1.5px solid #e5d2b8;
  image-rendering: pixelated;
}

.cloud-qr-hint {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.35;
}

.cloud-restore-pane {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cloud-code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}



