
/* Canonical game-data version and changelog styles moved to unified topbar section below */

@keyframes simulationFadeIn { from { opacity: 0; } to { opacity: 1; } }

.changelog-empty {
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}

@media (max-width: 768px) {
  .data-status-cluster { flex: 1 1 auto; min-width: 0; width: auto; gap: 4px; }
  .changelog-open-btn { flex: 0 0 auto; padding: 0 7px; font-size: 10px; }
}

@media (max-width: 720px) {
  .data-status-cluster {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }

  .topbar .data-status-cluster {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    margin-top: 0;
    gap: 4px;
  }

  .topbar .data-version-badge {
    min-width: 0;
    padding: 0 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
  }

  .topbar .changelog-open-btn {
    flex: 0 0 auto;
    padding: 0 7px;
    font-size: 10px;
  }

  .changelog-header,
  .changelog-body {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 360px) {
  .topbar .data-version-badge {
    font-size: 0;
  }

  .topbar .data-version-badge::after {
    content: "v" attr(data-version);
    font-size: 10px;
    letter-spacing: .02em;
  }
}

/* Historical event records remain readable but are intentionally muted. */
.compendium-history-section {
  margin-top: 32px;
  border-top: 1px solid var(--white-a10);
  padding-top: 20px;
}

.history-section-marker {
  display: inline-block;
  width: 4px;
  height: 18px;
  margin-right: 8px;
  border-radius: 2px;
  background: #7f8796;
  vertical-align: middle;
}

.compendium-history-note {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
}

/* Changelog modal */
.changelog-modal {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: cardFadeIn 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.changelog-surface {
  position: relative;
  width: min(860px, calc(100vw - 32px));
  max-height: min(820px, calc(100dvh - 32px));
  overflow-y: auto;
  overflow-x: hidden;
  color: rgba(255, 255, 255, 0.9);
  background: #1b1429;
  background-image: none;
  border: 2px solid var(--accent-violet);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.9), 0 0 0 1px var(--accent-violet-a25);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Changelog modal header */
.changelog-modal .changelog-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px 18px;
  background: #231a35;
  border-bottom: 1px solid var(--accent-violet-a30);
}

.changelog-header-main {
  flex: 1;
  min-width: 0;
}

.changelog-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--positive);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.changelog-title {
  margin: 4px 0 4px;
  color: var(--white);
  font-size: 24px;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.changelog-current {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.changelog-current strong {
  color: #d9f8ca;
}

.changelog-intro {
  margin: 0;
  color: #b7a6d6;
  font-size: 13px;
  line-height: 1.45;
}

.changelog-current-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: #ded8e8;
}

.changelog-current-line strong {
  color: var(--accent-gold-bright);
  font-family: var(--font-numeric), sans-serif;
  font-size: 14px;
}

.changelog-current-state {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(126, 227, 82, 0.18);
  border: 1px solid rgba(126, 227, 82, 0.35);
  color: #8ae665;
  font-size: 11px;
  font-weight: 750;
}

/* 更新日誌 4 統計 Bento 卡片 */
.changelog-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 16px 26px;
  background: #161022;
  border-bottom: 1px solid var(--accent-violet-a25);
}

.changelog-summary-card {
  padding: 10px 14px;
  background: #251b38;
  border: 1px solid var(--accent-violet-a25);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.changelog-summary-card.is-current {
  border-color: rgba(126, 227, 82, 0.5);
  background: #202b28;
}

.changelog-summary-card span {
  color: var(--ink-violet-dim);
  font-size: 11px;
  font-weight: 700;
}

.changelog-summary-card strong {
  color: var(--white);
  font-family: var(--font-numeric), sans-serif;
  font-size: 20px;
  font-weight: 850;
}

.changelog-summary-card.is-current strong {
  color: var(--positive);
}

.changelog-summary-card small {
  color: #7b6f93;
  font-size: 10.5px;
}

/* 舊彈窗更新日誌時間軸內容區 */
.changelog-modal .changelog-body {
  padding: 20px 26px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.changelog-body-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--white);
  font-size: 15px;
  font-weight: 850;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--accent-violet-a25);
}

.changelog-data-badge {
  font-size: 11px;
  font-weight: 750;
  color: var(--positive);
  background: rgba(126, 227, 82, 0.15);
  border: 1px solid rgba(126, 227, 82, 0.35);
  padding: 2px 8px;
  border-radius: 6px;
}

.changelog-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.changelog-entry {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--white-a10);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.changelog-entry-rail {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 18px;
}

.changelog-entry-dot {
  position: relative;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-gold-bright);
  border: 2px solid #241b3a;
  box-shadow: 0 0 8px rgba(255, 216, 89, 0.7);
}

.changelog-entry-line {
  position: absolute;
  top: 30px;
  bottom: -20px;
  width: 2px;
  background: rgba(140, 103, 232, 0.35);
}

.changelog-entry:last-child .changelog-entry-line {
  display: none;
}

.changelog-entry-card {
  padding: 16px 18px;
  background: #251b38;
  border: 1.5px solid var(--accent-violet-a30);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.changelog-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.changelog-entry-header h3 {
  margin: 0;
  color: #f9da67;
  font-size: 18px;
}

.changelog-entry-version-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.changelog-entry-version-row h3 {
  margin: 0;
  color: var(--accent-gold-bright);
  font-family: var(--font-numeric), sans-serif;
  font-size: 20px;
  font-weight: 850;
}

.changelog-entry-from {
  color: var(--ink-violet-dim);
  font-size: 12px;
}

.changelog-entry-header time {
  color: #7b6f93;
  font-size: 12px;
}

.changelog-entry-count {
  font-size: 11px;
  font-weight: 750;
  color: #ded8e8;
  background: #1b1429;
  border: 1px solid var(--accent-violet-a30);
  padding: 2px 8px;
  border-radius: 6px;
}

.changelog-topology {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.changelog-topology span {
  font-size: 11.5px;
  color: var(--ink-violet-soft);
  background: #1b1429;
  border: 1px solid var(--accent-violet-a30);
  padding: 3px 8px;
  border-radius: 6px;
}

.changelog-category {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(140, 103, 232, 0.2);
}

.changelog-category-heading {
  display: flex;
  align-items: center;
  gap: 6px;
}

.changelog-category-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 900;
}

.changelog-category.is-added .changelog-category-mark {
  background: rgba(126, 227, 82, 0.2);
  color: var(--positive);
}

.changelog-category.is-modified .changelog-category-mark {
  background: rgba(255, 216, 89, 0.2);
  color: var(--accent-gold-bright);
}

.changelog-category.is-removed .changelog-category-mark {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.changelog-category.is-schema_changes .changelog-category-mark {
  background: rgba(69, 145, 240, 0.2);
  color: #4591f0;
}

.changelog-category.is-important_values .changelog-category-mark {
  background: rgba(170, 60, 234, 0.2);
  color: #c35efc;
}

.changelog-category h4 {
  margin: 0;
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
}

.changelog-category-count {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-violet-dim);
}

.changelog-category ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-violet-soft);
  font-size: 12.5px;
  line-height: 1.55;
}

.changelog-source-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #1d2b24;
  border: 1px solid rgba(126, 227, 82, 0.3);
  border-radius: 10px;
}

.changelog-source-mark {
  font-size: 14px;
  color: var(--positive);
}

.changelog-source-card strong {
  display: block;
  color: var(--positive);
  font-size: 12px;
}

.changelog-source-card p {
  margin: 2px 0 0;
  color: var(--ink-violet-soft);
  font-size: 12px;
}

.changelog-notes {
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(140, 103, 232, 0.2);
  color: var(--ink-violet-dim);
  font-size: 11.5px;
  line-height: 1.45;
}

.changelog-notes p {
  margin: 2px 0;
}

/* 在極窄小螢幕（<= 320px）下的緊湊防重疊適配 */
@media (max-width: 320px) {
  #data-version-badge {
    display: none !important;
  }

  .data-status-cluster {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    min-width: 0;
  }

  .changelog-open-btn {
    padding-inline: 6px;
  }

}

/* Keep the narrowest supported phones from overlapping topbar actions. */
@media (max-width: 300px) {
  .topbar .data-version-badge {
    display: none;
  }

}

/* Keep every dynamic surface inside the reduced-motion contract, including
   the overlays added by the latest visual system rules above. */
@media (prefers-reduced-motion: reduce) {
  .changelog-modal,
  .changelog-modal * {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   模擬模式 Tooltip 消耗卡片整合按鈕 (純色雙框遊戲按鈕 & 斜角標籤)
   ============================================================ */

.simulation-action-btn-styled {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  min-height: 48px;
  margin: 0;
  padding: 4px 12px;
  border-radius: 8px;
  border: 2px solid var(--action-outline);
  background-color: var(--action-gold-border);
  box-shadow: 0 4px 0 rgba(34, 18, 38, 0.3);
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: transform 140ms cubic-bezier(0.34, 1.56, 0.64, 1), filter 120ms ease, box-shadow 120ms ease;
  overflow: visible;
}

.simulation-action-btn-styled + .rank-slider-wrap {
  margin-top: 10px;
}

/* Inner action surface */
.simulation-action-btn-styled::before {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  right: 2.5px;
  bottom: 2.5px;
  border: 1.5px solid var(--action-outline);
  border-radius: 5px;
  background-color: var(--action-gold-fill);
  pointer-events: none;
  box-sizing: border-box;
  z-index: 0;
}

.simulation-action-btn-styled:hover:not(:disabled) {
  filter: brightness(1.05);
}

.simulation-action-btn-styled:active:not(:disabled) {
  transform: scale(0.91);
  box-shadow: 0 1px 0 rgba(34, 18, 38, 0.3);
}

.simulation-action-btn-styled .sim-btn-cost {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--white);
  font-family: "Fredoka", "Arial Rounded MT Bold", "SF Pro Rounded", "Nunito", var(--font-numeric, sans-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  text-shadow:
    -1.2px -1.2px 0 #6C461B,
    1.2px -1.2px 0 #6C461B,
    -1.2px 1.2px 0 #6C461B,
    1.2px 1.2px 0 #6C461B,
    0 -1.2px 0 #6C461B,
    0 1.2px 0 #6C461B,
    -1.2px 0 0 #6C461B,
    1.2px 0 0 #6C461B;
  -webkit-text-stroke: 1.3px #6C461B;
  paint-order: stroke fill;
  letter-spacing: 0.01em;
}

.simulation-action-btn-styled .sim-btn-cost .currency-icon-svg {
  width: 25px;
  height: 25px;
  vertical-align: middle;
}

.simulation-action-btn-styled .sim-cost-num {
  font-variant-numeric: tabular-nums;
}

.simulation-action-btn-styled .sim-btn-text {
  position: relative;
  z-index: 1;
  color: var(--white);
  font-family: "Fredoka", "Arial Rounded MT Bold", "SF Pro Rounded", "Noto Sans TC", sans-serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  text-shadow:
    -1.2px -1.2px 0 #6C461B,
    1.2px -1.2px 0 #6C461B,
    -1.2px 1.2px 0 #6C461B,
    1.2px 1.2px 0 #6C461B,
    0 -1.2px 0 #6C461B,
    0 1.2px 0 #6C461B,
    -1.2px 0 0 #6C461B,
    1.2px 0 0 #6C461B;
  -webkit-text-stroke: 1.3px #6C461B;
  paint-order: stroke fill;
  letter-spacing: 0.02em;
}

/* 右上角斜向標籤 (Badge / Ribbon) */
.simulation-badge-slanted {
  position: absolute;
  top: -8px;
  right: -8px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 2px solid var(--action-outline);
  background: var(--accent-violet);
  color: var(--white);
  font-family: "Fredoka", var(--font-sans, "Noto Sans TC", sans-serif);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-shadow:
    -1px -1px 0 var(--action-outline),
    1px -1px 0 var(--action-outline),
    -1px 1px 0 var(--action-outline),
    1px 1px 0 var(--action-outline);
  box-shadow: 0 2px 5px var(--black-a40);
  transform: rotate(12deg);
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}

/* 取消解鎖 / 取消至此 風格按鈕：外圍細線圈 #9E435B，內部本體 #82263D */
.simulation-action-btn-styled.is-revoke {
  border-color: var(--action-outline);
  background-color: #9E435B;        /* 外圍細線圈顏色 (#9E435B) */
  box-shadow: 0 4px 0 rgba(34, 18, 38, 0.3);
}

.simulation-action-btn-styled.is-revoke::before {
  border-color: var(--action-outline);
  background-color: #82263D;        /* 內部較小本體顏色 (#82263D) */
}

.simulation-action-btn-styled.is-revoke:hover:not(:disabled) {
  filter: brightness(1.06);
}

.simulation-action-btn-styled.is-revoke:active:not(:disabled) {
  transform: scale(0.91);
  box-shadow: 0 1px 0 rgba(34, 18, 38, 0.3);
}

.simulation-action-btn-styled.is-revoke .sim-btn-text,
.simulation-action-btn-styled.is-revoke .sim-btn-cost {
  text-shadow:
    -1.2px -1.2px 0 #3B0E17,
    1.2px -1.2px 0 #3B0E17,
    -1.2px 1.2px 0 #3B0E17,
    1.2px 1.2px 0 #3B0E17,
    0 -1.2px 0 #3B0E17,
    0 1.2px 0 #3B0E17,
    -1.2px 0 0 #3B0E17,
    1.2px 0 0 #3B0E17;
  -webkit-text-stroke: 1.3px #3B0E17;
}

/* 禁用 / 特殊條件狀態 */
.simulation-action-btn-styled.is-disabled,
.simulation-action-btn-styled:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  filter: grayscale(0.5);
  border-color: var(--action-outline);
  background-color: #6C6280;
  box-shadow: none;
  transform: none !important;
}

.simulation-action-btn-styled.is-disabled::before,
.simulation-action-btn-styled:disabled::before {
  border-color: var(--action-outline);
  background-color: #4D4460;
}

/* ==========================================================================
   Detailed Stats Modal (詳細能力浮層面板)
   ========================================================================== */
@keyframes detailedStatsCardPop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes detailedStatsCardExit {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.94) translateY(10px);
  }
}

@keyframes detailedStatsFadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.detailed-stats-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(12, 8, 22, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: simulationFadeIn 180ms ease-out;
}

.detailed-stats-modal-backdrop.is-closing {
  animation: detailedStatsFadeOut 180ms ease-in forwards;
  pointer-events: none;
}

.detailed-stats-modal-backdrop.is-closing .detailed-stats-card {
  animation: detailedStatsCardExit 180ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

.detailed-stats-modal-backdrop[hidden] {
  display: none !important;
}

.detailed-stats-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(440px, calc(100vw - 32px));
  max-width: min(440px, calc(100vw - 32px));
  max-height: min(82vh, 620px);
  background: var(--surface-deep);
  border: 3px solid var(--accent-violet);
  border-radius: 16px;
  box-shadow: 0 16px 36px var(--black-a65), 0 0 0 1px var(--white-a05);
  overflow: hidden;
  box-sizing: border-box;
  animation: detailedStatsCardPop 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.detailed-stats-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--white-a08);
  flex-shrink: 0;
}

.detailed-stats-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.01em;
  text-align: center;
  text-shadow: 0 2px 4px var(--black-a50);
}

.detailed-stats-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  border-radius: 6px;
  transition: color 120ms, transform 120ms;
}

.detailed-stats-close-btn:hover {
  color: var(--white);
  transform: scale(1.1);
}

.detailed-stats-close-btn:active {
  transform: scale(0.92);
}

.detailed-stats-body {
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 14px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.detailed-stats-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.detailed-stats-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detailed-stats-branch-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--branch-color, var(--white));
  margin-top: 4px;
  margin-bottom: 2px;
  text-shadow: 0 1px 3px var(--black-a60);
}

.detailed-stats-branch-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.detailed-stats-branch-name {
  line-height: 1.2;
}

.detailed-stats-item {
  background: #352f47;
  border: 1px solid var(--white-a08);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  line-height: 1.35;
  box-shadow: inset 0 1px 0 var(--white-a05), 0 2px 6px var(--black-a40);
  box-sizing: border-box;
}

.detailed-stats-empty-hint {
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}
