/* ── Overlay base ── */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: var(--overlay-bg);
  display: flex;
  flex-direction: column;
  animation: overlay-in 0.2s ease-out;
}

@keyframes overlay-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.overlay-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  height: 52px;
  padding: 14px 17px 0;
  flex-shrink: 0;
}

.overlay-back-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(ellipse at center, rgba(247, 249, 252, 0.08), transparent 66%),
    linear-gradient(to bottom, rgba(15, 24, 39, 0.34), rgba(15, 24, 39, 0.22));
  backdrop-filter: blur(12px) saturate(0.92);
  -webkit-backdrop-filter: blur(12px) saturate(0.92);
  clip-path: var(--clip-cut-sm);
  color: rgba(247, 249, 252, 0.94);
  filter: drop-shadow(0 3px 12px rgba(0, 0, 0, 0.42));
  font-size: 0;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity var(--duration-fast);
}

.overlay-back-btn::after {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("../../assets/ui/svg/ic_back.svg") center / contain no-repeat;
  mask: url("../../assets/ui/svg/ic_back.svg") center / contain no-repeat;
  opacity: 0.96;
  filter:
    drop-shadow(0 1px 2px rgba(0, 0, 0, 0.64))
    drop-shadow(0 0 8px rgba(247, 249, 252, 0.20));
}

.overlay-back-btn:hover {
  opacity: 0.9;
}

.overlay-back-btn:focus-visible {
  outline: 1px solid rgba(215, 190, 134, 0.72);
  outline-offset: 2px;
}

.overlay-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-secondary);
  visibility: hidden;
}

.backlog-overlay .overlay-title {
  visibility: visible;
}

.backlog-overlay .overlay-back-btn {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.overlay-spacer {
  width: 36px;
}

.overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 26px 20px 32px;
  scrollbar-width: thin;
  scrollbar-color: rgba(247, 249, 252, 0.34) transparent;
}

.catalog-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(247, 249, 252, 0.34) transparent;
}

.overlay-body::-webkit-scrollbar,
.catalog-list::-webkit-scrollbar {
  width: 4px;
}

.overlay-body::-webkit-scrollbar-track,
.catalog-list::-webkit-scrollbar-track {
  background: transparent;
}

.overlay-body::-webkit-scrollbar-thumb,
.catalog-list::-webkit-scrollbar-thumb {
  min-height: 42px;
  border-radius: 999px;
  background:
    linear-gradient(to bottom, rgba(247, 249, 252, 0.58), rgba(247, 249, 252, 0.24));
  box-shadow: 0 0 10px rgba(247, 249, 252, 0.14);
}

.overlay-body::-webkit-scrollbar-thumb:hover,
.catalog-list::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(to bottom, rgba(247, 249, 252, 0.72), rgba(247, 249, 252, 0.34));
}

.overlay-heading {
  font-family: var(--font-serif);
  font-size: 27px;
  color: var(--text-primary);
  margin-bottom: 22px;
}

/* ── Game Menu ── */
.game-menu-overlay {
  background: transparent;
}

.game-menu-backdrop {
  position: absolute;
  inset: 0;
  background: var(--black-60);
}

.game-menu-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-lg);
}

.game-menu-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 200px;
}

.game-menu-btn {
  width: 100%;
  padding: 14px 0;
  font-family: var(--font-serif);
  font-size: var(--fs-choice);
  color: var(--text-primary);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  clip-path: polygon(
    var(--cut-sm) 0, calc(100% - var(--cut-sm)) 0,
    100% var(--cut-sm), 100% calc(100% - var(--cut-sm)),
    calc(100% - var(--cut-sm)) 100%, var(--cut-sm) 100%,
    0 calc(100% - var(--cut-sm)), 0 var(--cut-sm)
  );
  text-align: center;
  transition: background var(--duration-fast);
  pointer-events: auto;
}

.game-menu-btn:hover {
  background: var(--glass-bg);
}

.game-menu-close {
  font-size: 13px;
  color: var(--text-secondary);
  opacity: 0.7;
  pointer-events: auto;
}

/* ── Save/Load ── */
.save-slot-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.save-slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 12px 18px;
  background: linear-gradient(90deg,
    var(--glass-bg-strong) 0%,
    var(--gray-blue-12) 60%,
    transparent 100%
  );
  clip-path: polygon(
    var(--cut-sm) 0, calc(100% - var(--cut-sm)) 0,
    100% var(--cut-sm), 100% calc(100% - var(--cut-sm)),
    calc(100% - var(--cut-sm)) 100%, var(--cut-sm) 100%,
    0 calc(100% - var(--cut-sm)), 0 var(--cut-sm)
  );
  pointer-events: auto;
  transition: background var(--duration-fast);
}

.save-slot-row.clickable {
  cursor: pointer;
}

.save-slot-row.clickable:hover {
  background: linear-gradient(90deg,
    var(--glass-bg) 0%,
    var(--gray-blue-18) 60%,
    transparent 100%
  );
}

.save-slot-row.disabled {
  opacity: 0.45;
  cursor: default;
}

.save-slot-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.save-slot-title {
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 400;
}

.save-slot-time {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* ── Settings (§1 system-level bg + glass panel) ── */
.settings-overlay {
  background: transparent;
}

.settings-overlay .overlay-body,
.save-load-overlay .overlay-body {
  background: var(--glass-panel-bg);
  border: 1px solid var(--glass-panel-border);
  backdrop-filter: var(--glass-panel-blur);
  -webkit-backdrop-filter: var(--glass-panel-blur);
  margin: 0 18px 34px;
  padding: 18px;
  clip-path: var(--clip-cut-md);
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-section-title {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  text-transform: uppercase;
  padding: 8px 18px 0;
  margin-top: 6px;
}

.settings-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 10px 18px;
  background: linear-gradient(90deg,
    var(--glass-bg-strong) 0%,
    var(--gray-blue-12) 60%,
    transparent 100%
  );
  clip-path: polygon(
    var(--cut-sm) 0, calc(100% - var(--cut-sm)) 0,
    100% var(--cut-sm), 100% calc(100% - var(--cut-sm)),
    calc(100% - var(--cut-sm)) 100%, var(--cut-sm) 100%,
    0 calc(100% - var(--cut-sm)), 0 var(--cut-sm)
  );
  cursor: pointer;
  pointer-events: auto;
}

.settings-row:hover {
  background: linear-gradient(90deg,
    var(--glass-bg) 0%,
    var(--gray-blue-18) 60%,
    transparent 100%
  );
}

.settings-label {
  font-size: var(--fs-choice);
  color: var(--text-primary);
}

.settings-value {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ── Backlog (paged, per-page scroll) ── */
.backlog-overlay {
  background: var(--nagi-deep-blue-night);
  overflow: hidden;
}

.backlog-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.74;
  pointer-events: none;
  user-select: none;
}

.recap-page {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 84px 38px 34px;
  background: rgba(19, 32, 51, 0.58);
  overflow: hidden;
  touch-action: pan-x;
}

.recap-inner {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  text-shadow: 0 1px 8px rgba(10, 15, 25, 0.18);
  padding-bottom: 24px;
}

.recap-narr {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.88;
  color: rgba(244, 241, 234, 0.92);
}

.recap-line {
  margin: 0;
  padding-left: 15px;
  padding-right: 15px;
}

.recap-who {
  margin: 0 0 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #D7BE86;
}

.recap-say {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.68;
  color: rgba(247, 249, 252, 0.94);
}

.recap-line.cont {
  margin-top: 8px;
}

.recap-narr + .recap-narr {
  margin-top: 12px;
}

.recap-line + .recap-line,
.recap-line.cont + .recap-line {
  margin-top: 16px;
}

.recap-line + .recap-line.cont {
  margin-top: 8px;
}

.recap-line + .recap-narr,
.recap-narr + .recap-line {
  margin-top: 28px;
}

.backlog-pager {
  position: relative;
  z-index: 2;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 2px;
  padding: 12px 0 max(20px, env(safe-area-inset-bottom, 0));
  flex-shrink: 0;
}

.backlog-empty {
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
  padding-top: 60px;
}

.backlog-entry {
  width: 100%;
}

.backlog-speaker {
  font-size: 13px;
  font-weight: 600;
  color: var(--nagi-pale-gold);
  letter-spacing: 0.02em;
  text-shadow: 0 2px 10px var(--black-28);
  margin-bottom: 10px;
}

.backlog-text {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.92;
  color: var(--parchment-92);
  text-shadow: 0 1px 8px var(--ink-shadow-18);
}

.backlog-gap {
  height: 26px;
}

.backlog-gap-sm {
  height: 22px;
}

/* ── Chapter Catalog (Section 16 dark glass) ── */
.catalog-overlay {
  background: transparent;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
}

.catalog-panel {
  position: relative;
  margin: 84px 18px 34px;
  flex: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  background: var(--glass-panel-bg);
  border: 1px solid var(--glass-panel-border);
  backdrop-filter: var(--glass-panel-blur);
  -webkit-backdrop-filter: var(--glass-panel-blur);
  clip-path: var(--clip-cut-md);
  padding: 18px;
  overflow: hidden;
}

.catalog-head {
  display: grid;
  gap: 6px;
}

.catalog-head .page-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--text-primary);
  margin: 0;
}

.catalog-head p {
  margin: 0;
  color: var(--parchment-70);
  font-size: 12px;
  line-height: 1.7;
}

.catalog-list {
  display: grid;
  gap: 10px;
  align-content: start;
  overflow-y: auto;
}

.catalog-row {
  min-height: 68px;
  padding: 13px 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: var(--white-045);
  border: 1px solid var(--white-07);
  clip-path: var(--clip-cut-sm);
  pointer-events: auto;
}

.catalog-row.clickable {
  cursor: pointer;
}

.catalog-row.clickable:hover {
  background: var(--white-08);
}

.catalog-row.current {
  background: linear-gradient(to right, var(--gold-18), var(--white-04));
  border-color: var(--gold-28);
}

.catalog-row.locked {
  opacity: 0.52;
}

.catalog-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: rgba(247, 249, 252, 0.90);
  background: rgba(15, 24, 39, 0.26);
  border: 1px solid var(--glass-panel-border);
  clip-path: var(--clip-cut-sm);
  font-size: 12px;
}

.catalog-row.current .catalog-mark {
  color: var(--gold-100);
  border-color: rgba(215, 190, 134, 0.34);
}

.catalog-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.catalog-copy strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--snow-94);
  font-size: 15px;
  font-weight: 500;
}

.catalog-copy small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--parchment-64);
  font-size: 12px;
}

.catalog-state {
  justify-self: end;
  font-size: 12px;
  color: var(--parchment-70);
}

.catalog-row.current .catalog-state {
  color: var(--gold-100);
}

.catalog-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--white-08);
  font-size: 14px;
  color: var(--parchment-82);
}

.catalog-actions strong {
  color: rgba(247, 249, 252, 0.96);
  font-weight: 500;
}

.catalog-actions span,
.catalog-actions strong {
  cursor: pointer;
  pointer-events: auto;
}

/* ── NagiDialog (§11 / §16.5 / §17.3) ── */
.nagi-dialog-scrim {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: var(--dialog-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlay-in 0.2s ease-out;
}

.nagi-dialog-card {
  position: relative;
  width: calc(100% - 56px);
  max-width: 364px;
  min-height: 140px;
  background: var(--dialog-card-bg);
  border: 1px solid var(--dialog-border);
  clip-path: var(--clip-cut-md);
  padding: 22px 22px 18px;
  box-shadow: var(--dialog-shadow);
  pointer-events: auto;
}

.nagi-dialog-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--dialog-inner-highlight);
  clip-path: var(--clip-cut-md);
  pointer-events: none;
}

.nagi-dialog-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--snow-96);
  margin-bottom: 14px;
}

.nagi-dialog-body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.9;
  color: var(--parchment-88);
  margin-bottom: 22px;
}

.nagi-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
}

.nagi-dialog-dismiss {
  font-size: 15px;
  color: var(--parchment-74);
  cursor: pointer;
  pointer-events: auto;
}

.nagi-dialog-confirm {
  font-size: 15px;
  font-weight: 500;
  color: #F7F9FC;
  cursor: pointer;
  pointer-events: auto;
}

.nagi-dialog-dismiss:hover,
.nagi-dialog-confirm:hover {
  opacity: 0.8;
}

/* ── Settings value right-align ── */
.settings-value {
  text-align: right;
}

/* ── BGM volume slider ── */
.settings-row-bgm {
  cursor: default;
}

.settings-bgm-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-bgm-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  border-radius: 2px;
  background: var(--white-28);
  outline: none;
  pointer-events: auto;
}

.settings-bgm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-primary, #F7F9FC);
  border: 2px solid var(--white-30);
  cursor: pointer;
}

.settings-bgm-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-primary, #F7F9FC);
  border: 2px solid var(--white-30);
  cursor: pointer;
}

.settings-bgm-value {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 32px;
  text-align: right;
}

/* ── Android download link ── */
.settings-row-download {
  text-decoration: none;
  color: inherit;
}

.settings-row-guide {
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
}

.ending-guide-overlay {
  background: var(--nagi-deep-blue-night);
  z-index: 20;
  overflow: hidden;
}

.ending-guide-overlay > .system-bg,
.ending-guide-overlay > .system-bg-overlay {
  display: none;
}

.ending-guide-header {
  position: relative;
  z-index: 2;
}

.ending-guide-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  margin: 0 8px 16px;
  padding: 24px 10px 56px;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 88% 0%, rgba(215, 190, 134, 0.16), transparent 34%),
    linear-gradient(to bottom, rgba(16, 24, 39, 0.40), rgba(16, 24, 39, 0.62));
  border: 1px solid rgba(255, 255, 255, 0.08);
  clip-path: var(--clip-cut-md);
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 24, 39, 0.72) transparent;
  text-align: left;
}

.ending-guide-body::-webkit-scrollbar {
  width: 6px;
}

.ending-guide-body::-webkit-scrollbar-track {
  background: transparent;
}

.ending-guide-body::-webkit-scrollbar-thumb {
  background: linear-gradient(to right, rgba(16, 24, 39, 0.82), rgba(48, 62, 82, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  box-shadow: inset 1px 0 rgba(255, 255, 255, 0.08), 0 0 8px rgba(9, 16, 28, 0.24);
}

.ending-guide-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to right, rgba(16, 24, 39, 0.92), rgba(67, 84, 108, 0.82));
}

.ending-guide-intro {
  position: relative;
  margin: -24px -10px 0;
  padding: 28px 10px 22px;
  background: linear-gradient(135deg, rgba(215, 190, 134, 0.16), rgba(255, 255, 255, 0.03) 52%, transparent);
  border-bottom: 1px solid rgba(215, 190, 134, 0.26);
}

.ending-guide-kicker {
  margin: 0 0 6px;
  color: var(--accent-gold);
  font-size: 10px;
  letter-spacing: 0.18em;
}

.ending-guide-intro h1 {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
}

.ending-guide-intro p:last-child,
.ending-guide-paragraph {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.8;
}

.ending-guide-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.ending-guide-pills span {
  padding: 5px 9px;
  color: var(--parchment-74);
  background: rgba(9, 16, 28, 0.38);
  border: 1px solid rgba(215, 190, 134, 0.26);
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.ending-guide-section {
  position: relative;
  margin-top: 14px;
  padding: 18px 14px 16px;
  background: rgba(9, 16, 28, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.08);
  clip-path: var(--clip-cut-sm);
}

.ending-guide-section h2 {
  margin: 0 0 14px;
  padding-bottom: 9px;
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 400;
  border-bottom: 1px solid rgba(215, 190, 134, 0.22);
}

/* 总路线图保留原文等宽分支，窄屏缩放而不是折行打散连线。 */
.ending-guide-section:nth-of-type(5) .ending-guide-code {
  overflow: hidden;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  font-size: clamp(7px, 1.65vw, 11px);
  letter-spacing: -0.035em;
}

.ending-guide-route-map {
  width: 100%;
  margin: 10px 0 2px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  clip-path: var(--clip-cut-sm);
}

.ending-guide-route-map svg {
  display: block;
  width: 100%;
  height: auto;
}

.ending-guide-route-map img {
  display: block;
  width: 100%;
  height: auto;
}

.ending-guide-section:nth-of-type(7) h2,
.ending-guide-section:nth-of-type(8) h2,
.ending-guide-section:nth-of-type(9) h2 {
  color: var(--accent-gold);
}

.ending-guide-section:nth-of-type(5) { border-color: rgba(215, 190, 134, 0.32); }
.ending-guide-section:nth-of-type(6) { border-color: rgba(201, 138, 150, 0.30); }
.ending-guide-section:nth-of-type(7) { border-color: rgba(118, 151, 178, 0.30); }

.ending-guide-section:nth-of-type(n + 5) .ending-guide-code {
  text-align: center;
}

.ending-guide-section:first-of-type .ending-guide-code {
  text-align: center;
}

.ending-guide-label {
  margin: 14px 0 8px;
  color: var(--accent-gold);
  font-size: 12px;
  font-weight: 500;
}

.ending-guide-code {
  margin: 10px 0;
  padding: 12px 14px;
  overflow-x: hidden;
  color: var(--parchment-74);
  background: rgba(9, 16, 28, 0.52);
  border-left: 2px solid var(--accent-gold);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
}

.ending-guide-table-wrap {
  overflow-x: hidden;
  margin: 10px 0;
}

.ending-guide-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.ending-guide-table-2 th:first-child,
.ending-guide-table-2 td:first-child {
  width: 28%;
}

.ending-guide-table-2 th:last-child,
.ending-guide-table-2 td:last-child {
  width: 72%;
}

.ending-guide-table-3 th:nth-child(1),
.ending-guide-table-3 td:nth-child(1) { width: 27%; }
.ending-guide-table-3 th:nth-child(2),
.ending-guide-table-3 td:nth-child(2) { width: 38%; }
.ending-guide-table-3 th:nth-child(3),
.ending-guide-table-3 td:nth-child(3) { width: 35%; }

/* 结局快速索引：1、3 列内容极短（TRUE/GOOD、M/J），让位给 2、4 列的长文案 */
.ending-guide-table-4 th:nth-child(1),
.ending-guide-table-4 td:nth-child(1) { width: 16%; }
.ending-guide-table-4 th:nth-child(2),
.ending-guide-table-4 td:nth-child(2) { width: 35%; }
.ending-guide-table-4 th:nth-child(3),
.ending-guide-table-4 td:nth-child(3) { width: 13%; }
.ending-guide-table-4 th:nth-child(4),
.ending-guide-table-4 td:nth-child(4) { width: 36%; }

.ending-guide-table th,
.ending-guide-table td {
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ending-guide-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

.ending-guide-table th {
  color: var(--text-primary);
  background: rgba(215, 190, 134, 0.12);
  font-weight: 500;
}

@media (max-width: 520px) {
  .ending-guide-body { margin-left: 4px; margin-right: 4px; padding-left: 8px; padding-right: 8px; }
  .ending-guide-intro h1 { font-size: 21px; }
}

/* ── Gallery overlay: four-ending staggered wall ── */
.gallery-overlay {
  background: transparent;
}

.gallery-overlay .overlay-header {
  height: 52px;
}

.gallery-overlay .overlay-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  margin: 14px 16px 28px;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(247, 249, 252, 0.08), transparent 42%),
    linear-gradient(to bottom, rgba(16, 24, 39, 0.18), rgba(16, 24, 39, 0.30) 44%, rgba(16, 24, 39, 0.50));
}

.gallery-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.gallery-hero h2 {
  margin: 0;
  color: rgba(247, 249, 252, 0.94);
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.2;
}

.gallery-hero small {
  flex-shrink: 0;
  padding-bottom: 3px;
  color: rgba(244, 241, 234, 0.66);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.gallery-grid {
  height: calc(100% - 53px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: start;
  align-content: start;
  overflow: hidden;
}

.gallery-overlay .memory-card.ending-memory {
  aspect-ratio: 9 / 13.2;
  min-height: 0;
  padding: 13px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(to bottom, rgba(5, 8, 15, 0.02) 0%, rgba(5, 8, 15, 0.04) 46%, rgba(5, 8, 15, 0.72) 100%),
    var(--img, none) var(--crop, center) / cover no-repeat;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
  clip-path: var(--clip-cut-sm);
}

.gallery-overlay .memory-card-hit {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.gallery-overlay .ending-tag {
  color: var(--gold-100);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.gallery-overlay .ending-title {
  margin-top: 4px;
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.32;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.62);
}

.gallery-overlay .ending-title.long {
  font-size: 13px;
  letter-spacing: -0.02em;
}

.gallery-overlay .memory-card:nth-child(even) {
  margin-top: 14px;
}

.gallery-overlay .memory-card.locked {
  background:
    linear-gradient(to bottom, rgba(5, 8, 15, 0.10), rgba(5, 8, 15, 0.74)),
    rgba(255, 255, 255, 0.04);
  color: rgba(247, 249, 252, 0.56);
}

.gallery-overlay .memory-card.locked .ending-tag {
  color: rgba(215, 190, 134, 0.52);
}

.gallery-overlay .memory-card.locked .ending-title {
  color: rgba(247, 249, 252, 0.56);
}

.gallery-detail {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  background: #080d18;
}

.gallery-detail-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(9, 14, 24, 0.34), rgba(9, 14, 24, 0.52) 42%, rgba(9, 14, 24, 0.72)),
    var(--img) var(--crop, center) / cover no-repeat;
}

.gallery-detail-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(16, 35, 64, 0.12), transparent 48%),
    linear-gradient(to bottom, rgba(5, 8, 15, 0.36), rgba(5, 8, 15, 0.22) 38%, rgba(5, 8, 15, 0.64));
}

.gallery-detail-content {
  position: relative;
  z-index: 1;
  min-height: 100%;
  padding: 96px 42px 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  color: var(--text-primary);
}

.gallery-detail-tag {
  color: rgba(215, 190, 134, 0.82);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.48), 0 0 30px rgba(215, 190, 134, 0.18);
}

.gallery-detail-line {
  width: 178px;
  height: 5px;
  background:
    linear-gradient(to right, transparent, rgba(215, 190, 134, 0.48), transparent) center / 100% 1px no-repeat,
    linear-gradient(to right, transparent, rgba(215, 190, 134, 0.10), transparent);
}

.gallery-detail h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 33px;
  font-weight: 400;
  line-height: 1.34;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.48);
}

.gallery-detail p {
  max-width: 330px;
  margin: 0;
  color: rgba(247, 249, 252, 0.82);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.92;
  text-align: left;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.48);
}

.gallery-detail-status {
  margin-top: 2px;
  color: rgba(244, 241, 234, 0.56);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.48);
}

.gallery-detail-action,
.gallery-detail-back {
  border: 0;
  background: transparent;
  color: rgba(247, 249, 252, 0.94);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.48);
  cursor: pointer;
}

.gallery-detail-action {
  margin-top: 8px;
  font-size: 16px;
  letter-spacing: 0.10em;
}

.gallery-detail-back {
  font-size: 14px;
  letter-spacing: 0.12em;
  color: rgba(247, 249, 252, 0.82);
}
