/**
 * 合成张明旸 —— 排行榜样式
 * 配色跟游戏画面走：奶油底 + 焦糖橙描边 + 深棕字
 */

.zlb-root {
  --lb-ink: #5b4630;
  --lb-ink-soft: #94806a;
  --lb-accent: #f0a02c;
  --lb-accent-deep: #d4810f;
  --lb-line: #f0d6ab;
  --lb-card1: #fffdf7;
  --lb-card2: #fff2d8;
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 常驻入口：右上角小奖杯 ---------- */
.zlb-entry {
  position: absolute;
  z-index: 3;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  width: 44px;
  height: 44px;
  border: 2px solid #f0c987;
  border-radius: 50%;
  background: rgba(255, 249, 233, 0.94);
  box-shadow: 0 4px 12px rgba(120, 78, 24, 0.22);
  color: var(--lb-ink);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.zlb-entry:active {
  transform: scale(0.92);
}

.zlb-entry.is-hidden {
  display: none;
}

/* 有新名次时轻轻跳一下 */
.zlb-entry.is-bump {
  animation: zlb-bump 0.5s ease 2;
}

@keyframes zlb-bump {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-4px) scale(1.08); }
}

/* ---------- 结束页底部的名次按钮 ---------- */
.zlb-rank-pill {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(17% + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 2px solid #f6cf8d;
  border-radius: 999px;
  background: linear-gradient(180deg, #fffdf7, #ffeec8);
  box-shadow: 0 8px 22px rgba(70, 45, 12, 0.32);
  color: var(--lb-ink);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.zlb-rank-pill.is-show {
  display: flex;
  opacity: 1;
  transform: translate(-50%, 0);
}

.zlb-rank-pill:active {
  transform: translate(-50%, 0) scale(0.96);
}

.zlb-rank-pill em {
  font-style: normal;
  color: var(--lb-accent-deep);
  font-size: 16px;
}

/* ---------- 遮罩 + 面板 ---------- */
.zlb-mask {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(46, 32, 14, 0.55);
  pointer-events: auto;
}

.zlb-mask.is-open {
  display: flex;
  animation: zlb-fade 0.2s ease;
}

@keyframes zlb-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.zlb-card {
  width: 100%;
  max-width: 360px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  border: 2px solid #f3cd8e;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--lb-card1), var(--lb-card2));
  box-shadow: 0 22px 60px rgba(60, 38, 8, 0.4);
  overflow: hidden;
  transform: scale(0.94);
  animation: zlb-pop 0.26s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
}

@keyframes zlb-pop {
  to { transform: scale(1); }
}

.zlb-head {
  position: relative;
  padding: 18px 18px 12px;
  border-bottom: 1px dashed var(--lb-line);
}

.zlb-title {
  margin: 0;
  color: var(--lb-ink);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.zlb-sub {
  margin-top: 4px;
  color: var(--lb-ink-soft);
  font-size: 12px;
}

.zlb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(240, 214, 171, 0.55);
  color: var(--lb-ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.zlb-close:active {
  background: rgba(240, 214, 171, 0.9);
}

/* ---------- 列表 ---------- */
.zlb-list {
  flex: 1;
  min-height: 0;
  padding: 8px 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.zlb-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  color: var(--lb-ink);
  font-size: 14px;
  text-align: left;
}

.zlb-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.55);
}

.zlb-row.is-me {
  background: rgba(255, 209, 128, 0.42);
  box-shadow: inset 0 0 0 1.5px rgba(240, 160, 44, 0.75);
}

.zlb-no {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(200, 175, 140, 0.22);
  color: var(--lb-ink-soft);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.zlb-row[data-rank="1"] .zlb-no {
  background: linear-gradient(180deg, #ffd95e, #f2a71b);
  color: #6a4300;
  box-shadow: 0 2px 6px rgba(214, 150, 16, 0.45);
}

.zlb-row[data-rank="2"] .zlb-no {
  background: linear-gradient(180deg, #eceff4, #b9c1cd);
  color: #4a5464;
}

.zlb-row[data-rank="3"] .zlb-no {
  background: linear-gradient(180deg, #f0c193, #cd8a54);
  color: #59300f;
}

.zlb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zlb-me-tag {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--lb-accent);
  color: #fff;
  font-size: 10px;
  vertical-align: 1px;
}

.zlb-score {
  text-align: right;
  color: var(--lb-accent-deep);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.zlb-empty {
  padding: 34px 16px;
  color: var(--lb-ink-soft);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

/* ---------- 底部：昵称 ---------- */
.zlb-foot {
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px dashed var(--lb-line);
  background: rgba(255, 255, 255, 0.45);
}

.zlb-foot-row {
  display: flex;
  gap: 8px;
}

.zlb-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1.5px solid var(--lb-line);
  border-radius: 10px;
  background: #fff;
  color: var(--lb-ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.zlb-input:focus {
  border-color: var(--lb-accent);
}

.zlb-save {
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffb64d, #f09a1c);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(214, 138, 20, 0.35);
}

.zlb-save:active {
  transform: translateY(1px);
}

.zlb-tip {
  margin-top: 8px;
  color: var(--lb-ink-soft);
  font-size: 11px;
  line-height: 1.5;
}

/* ---------- 轻提示 ---------- */
.zlb-toast {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 16%;
  transform: translate(-50%, -6px);
  max-width: 76%;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(52, 36, 14, 0.86);
  color: #fff5e2;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.zlb-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 拉取失败时的重试 ---------- */
.zlb-retry {
  margin-top: 10px;
  padding: 8px 18px;
  border: 1.5px solid var(--lb-line);
  border-radius: 999px;
  background: #fff;
  color: var(--lb-accent-deep);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.zlb-retry:active {
  background: #fff4dd;
}
