* {
  box-sizing: border-box;
}

/* 文案未结算前隐藏 body，避免中文 HTML → 英文 → 中文穿帮 */
html.i18n-pending body {
  visibility: hidden;
}
html.i18n-ready body {
  visibility: visible;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  color: #e8e4dc;
  background: #0a0e14;
}

a {
  color: #c9a962;
}

.page-home {
  min-height: 100vh;
  overflow: hidden;
}

.home-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201, 169, 98, 0.12), transparent 60%),
    radial-gradient(circle at 20% 80%, rgba(59, 100, 140, 0.15), transparent 40%),
    linear-gradient(180deg, #121820 0%, #0a0e14 45%, #06080c 100%);
  pointer-events: none;
}

.home {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* 对称 padding：中间按钮始终视口居中，不受右侧公告栏影响 */
  padding: 32px 20px 48px;
}

.home-header {
  text-align: center;
  margin-bottom: 48px;
}

.home-top-right {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 40;
}

.home-version-tabs {
  display: flex;
  gap: 6px;
}

.home-records-btn {
  appearance: none;
  border: 1px solid rgba(201, 169, 98, 0.45);
  background: rgba(18, 22, 30, 0.78);
  color: #e8d5a8;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.home-records-btn:hover {
  border-color: rgba(201, 169, 98, 0.85);
  color: #fff6dc;
}

a.home-records-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.home-records-modal {
  position: fixed;
  inset: 0;
  /* 与缓存弹窗同级：须压过主页模式钮 / 公告 */
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-records-modal[hidden] {
  display: none !important;
}

.home-records-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.72);
}

.home-records-modal__panel {
  position: relative;
  width: min(860px, 92vw);
  max-height: min(78vh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1c2230 0%, #12161e 100%);
  border: 1px solid rgba(201, 169, 98, 0.35);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  padding: 18px 20px 16px;
}

.home-records-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.home-records-modal__head h2 {
  margin: 0;
  font-size: 18px;
  color: #f5e6c8;
  font-weight: 600;
}

.home-records-jump {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.home-records-jump__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(201, 169, 98, 0.28);
  background: #0e1218;
  color: #e8e4dc;
  padding: 0 12px;
  font: inherit;
  box-sizing: border-box;
}

.home-records-jump__input::placeholder {
  color: #6e634f;
}

.home-records-jump__btn {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(201, 169, 98, 0.45);
  background: rgba(24, 30, 40, 0.95);
  color: #f0ebe0;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
}

.home-records-jump__btn:hover {
  border-color: rgba(201, 169, 98, 0.75);
  background: rgba(201, 169, 98, 0.16);
}

.home-records-jump__btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

.home-records-modal__close {
  appearance: none;
  border: none;
  background: transparent;
  color: #a89878;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.home-records-modal__meta {
  margin: 0 0 10px;
  font-size: 12px;
  color: #8a7a5a;
}

.home-records-modal__table-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.home-records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #e8dcc0;
}

.home-records-table th,
.home-records-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(201, 169, 98, 0.15);
  text-align: left;
  vertical-align: middle;
}

.home-records-table th {
  color: #a89878;
  font-weight: 500;
  position: sticky;
  top: 0;
  background: #1c2230;
}

.home-records-table .home-records-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  max-width: 220px;
  user-select: text;
}

.home-records-table .btn-replay {
  appearance: none;
  border: 1px solid rgba(201, 169, 98, 0.5);
  background: rgba(201, 169, 98, 0.12);
  color: #f5e6c8;
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.home-records-table .btn-replay:hover {
  background: rgba(201, 169, 98, 0.28);
}

.home-records-empty {
  margin: 24px 0;
  text-align: center;
  color: #8a7a5a;
  font-size: 14px;
}

.home-version-tab {
  appearance: none;
  border: 1px solid rgba(201, 169, 98, 0.35);
  background: rgba(18, 22, 30, 0.72);
  color: #a89878;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.home-version-tab:hover {
  color: #f5e6c8;
  border-color: rgba(201, 169, 98, 0.7);
}

.home-version-tab.is-active {
  color: #1a140c;
  background: linear-gradient(180deg, #f5e6c8 0%, #c9a962 100%);
  border-color: transparent;
}

.home-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #8a7a5a;
}

.home-title {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  background: linear-gradient(180deg, #f5e6c8 0%, #c9a962 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: min(920px, 100%);
  align-items: stretch;
}

@media (max-width: 720px) {
  .home-modes {
    grid-template-columns: 1fr;
    width: min(420px, 100%);
  }
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 28px 24px;
  border: 1px solid rgba(201, 169, 98, 0.25);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(30, 38, 50, 0.95), rgba(18, 22, 30, 0.98));
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(201, 169, 98, 0.55);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.mode-card--primary {
  border-color: rgba(201, 169, 98, 0.45);
  box-shadow: 0 0 0 1px rgba(201, 169, 98, 0.1) inset;
}

.mode-icon {
  font-size: 28px;
  line-height: 1;
  opacity: 0.9;
}

.mode-name {
  font-size: 20px;
  font-weight: 600;
  color: #f0ebe0;
}

.mode-desc {
  font-size: 13px;
  color: #8b939f;
  line-height: 1.5;
}

.home-footer {
  margin-top: 40px;
}

.home-link {
  font-size: 13px;
  text-decoration: none;
  opacity: 0.6;
}

.home-link:hover {
  opacity: 1;
}

.home-logout-wrap {
  margin-top: 40px;
  text-align: center;
}

.home-logout {
  background: none;
  border: 1px solid #3a4554;
  color: #9aa4b4;
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.home-logout:hover {
  border-color: #c9a962;
  color: #c9a962;
}

.home-announcements {
  position: fixed;
  top: 50%;
  right: 0;
  bottom: auto;
  z-index: 30;
  transform: translateY(-50%);
  width: min(280px, 28vw);
  min-width: 200px;
  max-height: min(70vh, calc(100vh - 96px));
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
  pointer-events: none;
}

.home-announcements.is-hidden {
  display: none !important;
}

.home-announcements__panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 0;
  min-height: 0;
  max-height: min(70vh, calc(100vh - 96px));
  padding: 16px 14px;
  border: 1px solid rgba(201, 169, 98, 0.28);
  border-right: none;
  border-radius: 14px 0 0 14px;
  background: rgba(14, 18, 26, 0.82);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.home-announcements__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #c9a962;
  flex-shrink: 0;
}

.home-announcements__rail {
  appearance: none;
  pointer-events: auto;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(201, 169, 98, 0.35);
  background: rgba(18, 22, 30, 0.92);
  color: #c9a962;
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.home-announcements__rail:hover {
  color: #f5e6c8;
  border-color: rgba(201, 169, 98, 0.75);
  background: rgba(28, 34, 46, 0.98);
}

/* 面板打开时：贴在面板右侧边、竖直居中的收起条 */
.home-announcements__rail--hide {
  align-self: center;
  width: 22px;
  height: 72px;
  border-radius: 0 10px 10px 0;
  border-left: none;
  flex-shrink: 0;
}

.home-announcements__rail-chevron {
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
}

/* 面板关闭时：贴屏幕右缘、竖直居中的「公告」展开条 */
.home-announcements__rail--show {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 30;
  transform: translateY(-50%);
  width: 28px;
  min-height: 96px;
  padding: 14px 0;
  border-radius: 10px 0 0 10px;
  border-right: none;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.28em;
  font-size: 13px;
  font-weight: 600;
}

.home-announcements__rail--show[hidden] {
  display: none !important;
}

.home-announcements__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.home-announcements__item {
  margin: 0;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid rgba(201, 169, 98, 0.2);
  background: linear-gradient(145deg, rgba(36, 44, 58, 0.95), rgba(22, 28, 38, 0.98));
  color: #e8e4dc;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.home-announcements__empty {
  margin: 0;
  font-size: 13px;
  color: #8b939f;
}

@media (max-width: 900px) {
  .home-announcements {
    width: min(260px, calc(100vw - 36px));
    min-width: 0;
    max-height: min(48vh, 320px);
  }

  .home-announcements__panel {
    max-height: min(48vh, 320px);
  }
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  padding: 12px 20px;
  border-radius: 10px;
  background: rgba(28, 34, 46, 0.52);
  border: 1px solid rgba(201, 169, 98, 0.28);
  color: #f0ece6;
  font-size: 14px;
  pointer-events: none;
  /* 须高于检索/坟墓等弹层（.tomb-select=200），否则分列拖拽提示看不见 */
  z-index: 13000;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}

/* 通用确认弹窗（构筑 / 战斗覆盖确认 等） */
.ui-confirm {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0;
  overflow: hidden;
}

.ui-confirm[hidden] {
  display: none !important;
}

.ui-confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.ui-confirm__panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 420px);
  box-sizing: border-box;
  padding: 20px 18px 18px;
  border-radius: 12px;
  background: rgba(12, 16, 22, 0.98);
  border: 1px solid rgba(201, 169, 98, 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.ui-confirm__text {
  margin: 0;
  width: 100%;
  color: #d8dce4;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.ui-confirm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.ui-confirm__ok {
  min-width: 120px;
  padding: 8px 24px;
  border-radius: 8px;
  border: 1px solid rgba(201, 169, 98, 0.55);
  background: rgba(32, 28, 18, 0.95);
  color: #e8d4a8;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.ui-confirm__ok:hover {
  background: rgba(201, 169, 98, 0.22);
}

.ui-confirm__cancel {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(30, 34, 42, 0.95);
  color: #c8ccd4;
  cursor: pointer;
  font-size: 13px;
}

.ui-confirm__cancel:hover {
  background: rgba(255, 255, 255, 0.08);
}

.bug-report-modal__panel {
  width: min(92vw, 560px) !important;
  align-items: stretch !important;
}

.bug-report-modal__textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  box-sizing: border-box;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 10, 14, 0.92);
  color: #e8e4dc;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
}

.bug-report-modal__textarea:focus {
  outline: none;
  border-color: rgba(201, 169, 98, 0.55);
}

/* 兼容旧 class（战斗结束 / 检索栏按钮行等仍在用） */
.overlay-confirm__panel {
  width: min(92vw, 420px);
  height: auto;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 20px 18px 18px;
  gap: 14px;
}

.overlay-confirm__text {
  margin: 0;
  width: 100%;
  color: #d8dce4;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.overlay-confirm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.overlay-confirm__cancel {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(30, 34, 42, 0.95);
  color: #c8ccd4;
  cursor: pointer;
  font-size: 13px;
}

.overlay-confirm__cancel:hover {
  background: rgba(255, 255, 255, 0.08);
}

.home-cache-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  appearance: none;
  border: 1px solid rgba(201, 169, 98, 0.4);
  background: rgba(18, 22, 30, 0.88);
  color: #e8d5a8;
  font: inherit;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.home-cache-btn:hover {
  border-color: rgba(201, 169, 98, 0.85);
  color: #fff6dc;
}

.home-cache-modal {
  position: fixed;
  inset: 0;
  /* 须压过主页模式钮 / 顶栏 / 公告（含 transform 壳下的层叠），低于 toast(13000) */
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.home-cache-modal[hidden] {
  display: none !important;
}

.home-cache-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.home-cache-modal__panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 400px);
  border: 1px solid rgba(201, 169, 98, 0.35);
  border-radius: 14px;
  background: rgba(18, 22, 30, 0.96);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  padding: 0 0 18px;
  color: #e8e4dc;
}

.home-cache-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}

.home-cache-modal__head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #f0e6c8;
}

.home-cache-modal__close {
  appearance: none;
  border: none;
  background: transparent;
  color: #9aa4b4;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

.home-cache-modal__close:hover {
  color: #e8d5a8;
}

.home-cache-modal__body {
  padding: 4px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-cache-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.home-cache-row__label {
  font-size: 14px;
  color: #c8ccd4;
}

.home-cache-row__value {
  font-size: 15px;
  font-weight: 600;
  color: #f0e6c8;
  font-variant-numeric: tabular-nums;
}

.home-cache-modal__hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(232, 228, 220, 0.55);
}

.home-cache-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.home-cache-action {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(201, 169, 98, 0.45);
  background: rgba(201, 169, 98, 0.14);
  color: #f0e6c8;
  font: inherit;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.home-cache-action:hover {
  border-color: rgba(201, 169, 98, 0.85);
  background: rgba(201, 169, 98, 0.22);
}

.home-cache-action:disabled {
  opacity: 0.55;
  cursor: default;
}

