/* ============================================================
   交互精修层：可点击面积、层级、展陈质感与按钮反馈
   ============================================================ */

:root {
  --control-height: 42px;
  --control-radius: 3px;
  --control-border: rgba(255, 224, 214, 0.2);
  --control-surface: rgba(25, 13, 18, 0.92);
}

button,
[role="button"] {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid #ff6679;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(200, 16, 46, 0.14);
}

/* 顶部工具区：扩大热区，避免细窄按钮误触和点空 */
.app-shell .top-actions {
  gap: 7px;
  flex-wrap: nowrap;
}

.app-shell .topbar {
  grid-template-columns: minmax(190px, 0.7fr) auto auto;
}

.app-shell .tool-button {
  flex: 0 0 auto;
  min-width: 42px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 223, 214, 0.14);
  color: rgba(255, 244, 237, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 48%),
    rgba(25, 13, 18, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 242, 235, 0.08),
    0 3px 0 rgba(5, 2, 3, 0.62),
    0 9px 18px rgba(0, 0, 0, 0.3);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.app-shell .tool-button > span {
  white-space: nowrap;
}

.app-shell .tool-button:hover {
  color: #fff;
  border-color: rgba(255, 107, 125, 0.46);
  background:
    linear-gradient(180deg, rgba(230, 57, 70, 0.14), transparent 54%),
    rgba(69, 14, 26, 0.72);
}

.app-shell .tool-button:active,
.app-shell .tool-button.is-pressed {
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(5, 2, 3, 0.66);
  transform: translateY(2px) !important;
}

.app-shell .brand {
  min-height: 48px;
  padding-right: 14px;
}

/* 沙盘控制：所有控制键至少覆盖稳定可点击区域 */
.app-shell .map-zoom-controls {
  right: 16px;
  gap: 6px;
}

.app-shell .map-zoom-controls button {
  width: 40px;
  height: 40px;
  color: rgba(255, 245, 238, 0.86);
  border: 1px solid rgba(255, 223, 214, 0.18);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 235, 226, 0.1), transparent 42%),
    rgba(23, 12, 16, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 242, 234, 0.1),
    0 3px 0 rgba(5, 2, 3, 0.58),
    0 9px 18px rgba(0, 0, 0, 0.34);
  font-size: 19px;
  font-weight: 500;
}

.app-shell .map-zoom-controls button:hover {
  color: #fff;
  border-color: rgba(255, 100, 118, 0.68);
  background: rgba(119, 17, 36, 0.8);
  transform: translateY(-1px);
}

.app-shell .map-zoom-controls button:active {
  transform: translateY(2px) scale(0.96);
}

.war-layer-controls {
  top: 15px;
  left: 16px;
  gap: 5px;
  padding: 5px;
  border-color: rgba(255, 220, 210, 0.15);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 50%),
    rgba(14, 8, 11, 0.87);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 236, 0.06),
    0 8px 22px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
}

.war-layer-controls button {
  min-width: 56px;
  height: 34px;
  padding: 0 11px;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 600;
}

.war-layer-controls button.active {
  box-shadow:
    inset 0 1px 0 rgba(255, 239, 232, 0.11),
    0 0 14px rgba(200, 16, 46, 0.14);
}

.war-layer-controls button:active,
.war-layer-controls button.is-pressed {
  transform: translateY(2px) !important;
}

.war-archive-dock button {
  min-height: 54px;
  border-color: rgba(255, 102, 121, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 235, 0.07),
    0 10px 22px rgba(0, 0, 0, 0.3);
}

.war-archive-dock button:active,
.war-archive-dock button.is-pressed {
  transform: translateY(2px) scale(0.985) !important;
}

/* 事件浮窗：加强边界、层次和关闭按钮命中率 */
.app-shell .chronicle {
  border-color: rgba(255, 106, 124, 0.48);
  box-shadow:
    -18px 28px 64px rgba(0, 0, 0, 0.56),
    inset 0 1px 0 rgba(255, 242, 234, 0.08),
    inset 0 0 0 5px rgba(255, 255, 255, 0.014);
}

.event-panel-close {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-color: rgba(255, 223, 214, 0.18);
  color: rgba(255, 246, 240, 0.8);
  background: rgba(255, 255, 255, 0.03);
  font-size: 19px;
}

.event-panel-close:hover {
  background: rgba(200, 16, 46, 0.18);
  transform: rotate(90deg);
}

.event-panel-handle {
  width: 52px;
  min-height: 138px;
  border-color: rgba(255, 102, 121, 0.55);
  background:
    repeating-linear-gradient(135deg, transparent 0 9px, rgba(255, 255, 255, 0.025) 10px),
    linear-gradient(180deg, rgba(200, 16, 46, 0.28), rgba(63, 9, 20, 0.5)),
    #1b0c12;
}

.event-panel-handle:active,
.event-panel-handle.is-pressed {
  transform: translateX(-3px) !important;
}

.app-shell .event-photo-button,
.app-shell .chronicle-actions button,
.app-shell .chapter-nav button,
.app-shell .play-action,
.app-shell .icon-action {
  min-height: 38px;
}

.app-shell .chronicle-actions button,
.app-shell .event-photo-button {
  font-size: 11px;
  font-weight: 600;
}

/* 世界沙盘画面：珍珠灰陆块、朱红战区和微弱扫描光 */
.war-sand-ready .map-frame {
  border: 1px solid rgba(255, 142, 151, 0.24);
  background:
    radial-gradient(ellipse at 50% 42%, rgba(155, 77, 82, 0.14), transparent 48%),
    radial-gradient(ellipse at 48% 105%, rgba(200, 16, 46, 0.08), transparent 48%),
    #080607;
  box-shadow:
    inset 0 0 0 5px rgba(255, 232, 221, 0.018),
    inset 0 0 80px rgba(0, 0, 0, 0.58),
    0 20px 42px rgba(0, 0, 0, 0.36);
}

.war-sand-ready .map-frame::before {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(5, 3, 4, 0.32), transparent 9%, transparent 91%, rgba(5, 3, 4, 0.34)),
    linear-gradient(0deg, rgba(5, 3, 4, 0.3), transparent 14%, transparent 88%, rgba(5, 3, 4, 0.22));
  content: "";
  pointer-events: none;
}

.war-sand-ready .map-frame::after {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(112deg, transparent 31%, rgba(255, 189, 183, 0.035) 47%, transparent 62%);
  content: "";
  pointer-events: none;
  transform: translateX(-70%);
  animation: worldMapSheen 13s ease-in-out infinite;
}

@keyframes worldMapSheen {
  0%, 68% { transform: translateX(-70%); opacity: 0; }
  78% { opacity: 1; }
  100% { transform: translateX(70%); opacity: 0; }
}

.war-terrain-hud {
  padding: 6px 9px;
  border: 1px solid rgba(255, 222, 213, 0.09);
  background: rgba(13, 8, 10, 0.66);
  backdrop-filter: blur(8px);
}

.war-terrain-canvas {
  transition: filter 240ms ease;
}

.is-terrain-dragging .war-terrain-canvas {
  filter: brightness(1.08) saturate(1.08);
}

/* 顶部统计和图层标签提高辨识度 */
.app-shell .national-casualty > strong,
.app-shell .verified-casualty > strong {
  font-size: 23px;
  font-weight: 700;
}

.app-shell .national-casualty > span,
.app-shell .verified-casualty > span {
  color: rgba(255, 232, 222, 0.62);
  font-size: 8.5px;
}

.app-shell .casualty-method {
  color: rgba(255, 233, 224, 0.5);
  font-size: 8.5px;
}

/* 首页和入口按钮更稳定的命中反馈 */
.portal-card,
.exhibition-card,
.directory-sheet-grid button,
.portal-primary,
.portal-secondary,
.portal-user-chip,
.portal-directory-btn {
  -webkit-tap-highlight-color: transparent;
}

.exhibition-card:active,
.directory-sheet-grid button:active {
  transform: translateY(-1px) scale(0.992);
}

.exhibition-card .card-enter,
.directory-sheet-grid button small {
  transition: color 180ms ease, transform 180ms ease;
}

.exhibition-card:active .card-enter {
  color: #fff;
  transform: translateX(4px);
}

/* 弹窗按钮最小热区 */
.portal-gate .portal-primary,
.portal-gate .portal-secondary,
.portal-gate .close-button,
.portal-gate .portal-close,
.quiz-hint-btn,
.letter-fold-btn {
  min-height: 42px;
}

.portal-gate .portal-close {
  width: 42px;
  height: 42px;
}

.quiz-hint-btn:active,
.letter-fold-btn:active {
  transform: translateY(2px) !important;
}

@media (pointer: coarse) {
  .app-shell .tool-button,
  .app-shell .map-zoom-controls button,
  .war-layer-controls button,
  .event-panel-close,
  .portal-gate .portal-close,
  .portal-gate .portal-primary,
  .portal-gate .portal-secondary,
  .quiz-option,
  .quiz-hint-btn,
  .letter-fold-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .war-layer-controls button {
    min-width: 60px;
  }

  .app-shell .map-zoom-controls button {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 760px) {
  .app-shell .topbar {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app-shell .topbar::-webkit-scrollbar {
    display: none;
  }

  .app-shell .top-actions {
    min-width: max-content;
  }

  .war-layer-controls {
    right: 10px;
    left: 10px;
    justify-content: space-between;
  }

  .war-layer-controls button {
    flex: 1;
    min-width: 0;
  }

  .app-shell .chronicle {
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.62);
  }

  .event-panel-handle {
    min-height: 118px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .war-sand-ready .map-frame::after {
    animation: none;
    opacity: 0;
  }
}

/* ============================================================
   展陈装饰层：铜饰、卷宗、题签与书法竖向印章
   ============================================================ */

.terrain-ornament {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}

.terrain-corner {
  position: absolute;
  width: 58px;
  height: 58px;
  opacity: 0.74;
}

.terrain-corner::before,
.terrain-corner::after {
  position: absolute;
  content: "";
}

.terrain-corner::before {
  inset: 8px;
  border-color: rgba(255, 180, 176, 0.42);
}

.terrain-corner::after {
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 217, 205, 0.5);
  background: rgba(157, 26, 46, 0.36);
  transform: rotate(45deg);
}

.corner-tl {
  top: 8px;
  left: 8px;
}

.corner-tl::before {
  border-top: 1px solid;
  border-left: 1px solid;
}

.corner-tl::after {
  top: 4px;
  left: 4px;
}

.corner-tr {
  top: 8px;
  right: 8px;
}

.corner-tr::before {
  border-top: 1px solid;
  border-right: 1px solid;
}

.corner-tr::after {
  top: 4px;
  right: 4px;
}

.corner-bl {
  bottom: 8px;
  left: 8px;
}

.corner-bl::before {
  border-bottom: 1px solid;
  border-left: 1px solid;
}

.corner-bl::after {
  bottom: 4px;
  left: 4px;
}

.corner-br {
  right: 8px;
  bottom: 8px;
}

.corner-br::before {
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.corner-br::after {
  right: 4px;
  bottom: 4px;
}

.terrain-theater-caption {
  position: absolute;
  top: 14px;
  left: 50%;
  display: grid;
  min-width: 300px;
  padding: 5px 48px 7px;
  color: rgba(255, 235, 227, 0.4);
  border-top: 1px solid rgba(255, 145, 153, 0.2);
  text-align: center;
  transform: translateX(-50%);
}

.terrain-theater-caption::before,
.terrain-theater-caption::after {
  position: absolute;
  top: -3px;
  width: 38px;
  height: 5px;
  border-top: 1px solid rgba(230, 57, 70, 0.52);
  content: "";
}

.terrain-theater-caption::before {
  left: 0;
}

.terrain-theater-caption::after {
  right: 0;
}

.terrain-theater-caption span {
  color: rgba(255, 145, 153, 0.62);
  font-family: var(--portal-sans);
  font-size: 7px;
  letter-spacing: 0.15em;
}

.terrain-theater-caption strong {
  margin-top: 2px;
  color: rgba(255, 239, 232, 0.72);
  font-family: var(--portal-kai);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.terrain-side-scale {
  position: absolute;
  top: 34%;
  left: 13px;
  display: grid;
  gap: 42px;
  color: rgba(255, 225, 216, 0.24);
  font-family: var(--portal-sans);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.terrain-side-scale::before {
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: 23px;
  width: 1px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 210, 201, 0.24) 0 1px,
      transparent 1px 8px
    );
  content: "";
}

.terrain-side-scale span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.terrain-side-scale span::after {
  width: 14px;
  height: 1px;
  background: rgba(255, 210, 201, 0.28);
  content: "";
}

.terrain-theater-legend {
  position: absolute;
  bottom: 14px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 12px;
  color: rgba(255, 235, 226, 0.45);
  border: 1px solid rgba(255, 213, 203, 0.09);
  background: rgba(13, 8, 10, 0.62);
  font-family: var(--portal-serif);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  transform: translateX(-50%);
  backdrop-filter: blur(7px);
}

.terrain-theater-legend i {
  width: 15px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(230, 57, 70, 0.56), transparent);
}

.chronicle-dossier-mark {
  position: absolute;
  top: 15px;
  left: 17px;
  display: grid;
  width: 27px;
  height: 37px;
  place-items: center;
  color: rgba(255, 229, 221, 0.8);
  border: 1px solid rgba(255, 133, 143, 0.42);
  background:
    linear-gradient(180deg, rgba(200, 16, 46, 0.19), transparent),
    rgba(92, 13, 27, 0.28);
  font-family: var(--portal-kai);
  font-size: 9px;
  line-height: 1.05;
  writing-mode: vertical-rl;
  letter-spacing: 0.08em;
  transform: rotate(-2deg);
}

.app-shell .chronicle-top {
  position: relative;
  justify-content: flex-end;
  gap: 13px;
  padding-left: 46px;
}

.app-shell .chronicle-top .event-category {
  margin-right: auto;
}

.portal-vertical-slogan {
  position: absolute;
  top: 13%;
  right: 2%;
  z-index: 3;
  padding: 13px 8px;
  color: rgba(255, 224, 215, 0.32);
  border-right: 1px solid rgba(230, 57, 70, 0.52);
  font-family: var(--portal-kai);
  font-size: 13px;
  letter-spacing: 0.24em;
  line-height: 1.8;
  writing-mode: vertical-rl;
}

.portal-vertical-slogan::before {
  position: absolute;
  top: -9px;
  right: -3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e63946;
  box-shadow: 0 0 10px rgba(230, 57, 70, 0.7);
  content: "";
}

/* 章节和卡片边角的小型展签装饰 */
.portal-exhibitions,
.red-thread-section {
  position: relative;
}

.portal-exhibitions::before,
.red-thread-section::before {
  position: absolute;
  top: 42px;
  left: 0;
  width: 88px;
  height: 1px;
  background: linear-gradient(90deg, #e63946, transparent);
  content: "";
}

.portal-exhibitions::after,
.red-thread-section::after {
  position: absolute;
  top: 36px;
  left: 91px;
  width: 5px;
  height: 5px;
  border: 1px solid rgba(230, 57, 70, 0.58);
  content: "";
  transform: rotate(45deg);
}

.exhibition-card {
  box-shadow:
    inset 0 0 0 1px rgba(255, 235, 227, 0.018),
    0 16px 38px rgba(0, 0, 0, 0.22);
}

.exhibition-card::after {
  border-style: double;
  box-shadow:
    0 0 0 12px rgba(230, 57, 70, 0.025),
    0 0 0 15px rgba(245, 239, 230, 0.012);
}

.portal-footer {
  position: relative;
}

.portal-footer::before {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(230, 57, 70, 0.52);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

/* 时间轨道装饰 */
.app-shell .time-deck {
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 230, 0.04),
    0 16px 34px rgba(0, 0, 0, 0.34);
}

.app-shell .time-deck::before {
  position: absolute;
  top: 8px;
  right: 24px;
  left: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(230, 57, 70, 0.21), transparent);
  content: "";
  pointer-events: none;
}

@media (max-width: 1080px) {
  .terrain-theater-caption {
    min-width: 240px;
    padding-right: 28px;
    padding-left: 28px;
  }

  .terrain-side-scale {
    display: none;
  }
}

@media (max-width: 760px) {
  .terrain-theater-caption {
    top: 10px;
    min-width: 190px;
    padding: 4px 13px 5px;
  }

  .terrain-theater-caption strong {
    overflow: hidden;
    max-width: 190px;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .terrain-theater-legend {
    display: none;
  }

  .portal-vertical-slogan {
    top: 7%;
    right: 0;
    font-size: 10px;
  }
}

/* ============================================================
   第六版：朱漆展签、铜章按钮与字体细节
   ============================================================ */

:root {
  --button-red-light: #db304a;
  --button-red-mid: #b40f2d;
  --button-red-deep: #750d21;
  --button-ivory: #fff1e6;
  --button-bronze: rgba(225, 181, 117, 0.5);
}

body {
  font-kerning: normal;
  font-feature-settings: "kern" 1, "liga" 1;
}

.portal-home p,
.portal-gate p,
.immersive-scene p,
.app-shell p {
  text-wrap: pretty;
}

.portal-brand strong,
.app-shell .brand-copy strong {
  font-family: var(--portal-kai);
  letter-spacing: 0.13em;
}

.portal-brand small,
.app-shell .brand-copy small,
.section-kicker,
.scene-header p,
.map-heading p {
  font-family: var(--portal-sans);
  font-weight: 500;
}

.portal-hero h1 span,
.portal-hero h1 em,
.portal-hero h1 strong,
.portal-hero h1 b {
  letter-spacing: 0.01em;
  line-height: 1.05;
}

.portal-section-head h2,
.memory-gallery-head h2,
.scene-header h2,
.drawer-head h2,
.quiz-title-lockup h2,
.spirit-room header h2,
.guide-card header h2,
.letter-head strong {
  font-family: var(--portal-kai);
  letter-spacing: 0.055em;
}

.portal-lead,
.portal-section-head > p:last-child,
.memory-story-card p,
.thread-reading p,
.app-shell .event-narration,
.archive-drawer .battle-entry-body p,
.archive-drawer .archive-body p {
  font-family: var(--portal-serif);
  letter-spacing: 0.035em;
}

/* 主操作按钮：朱漆底、铜色天线与右侧星印 */
.portal-primary,
.app-shell .primary-action,
.enter-button,
.sand-play {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 230, 219, 0.26) !important;
  background:
    linear-gradient(108deg, rgba(255, 255, 255, 0.12), transparent 34%),
    linear-gradient(180deg, var(--button-red-light), var(--button-red-mid) 48%, var(--button-red-deep)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 241, 0.35),
    inset 0 0 0 2px rgba(78, 5, 18, 0.2),
    0 3px 0 #56101c,
    0 12px 25px rgba(85, 7, 21, 0.3) !important;
  color: var(--button-ivory) !important;
  font-family: var(--portal-kai) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  letter-spacing: 0.075em;
}

.portal-primary::before,
.app-shell .primary-action::before,
.enter-button::before,
.sand-play::before {
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 224, 205, 0.14);
  content: "";
  pointer-events: none;
}

.portal-primary:hover,
.app-shell .primary-action:hover,
.enter-button:hover,
.sand-play:hover {
  background:
    linear-gradient(108deg, rgba(255, 255, 255, 0.15), transparent 38%),
    linear-gradient(180deg, #ed4259, #c71635 46%, #871129) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 242, 0.4),
    inset 0 0 0 2px rgba(78, 5, 18, 0.18),
    0 5px 0 #5b101e,
    0 18px 30px rgba(110, 8, 28, 0.34) !important;
}

.portal-primary:active,
.app-shell .primary-action:active,
.enter-button:active,
.sand-play:active {
  box-shadow:
    inset 0 2px 5px rgba(56, 2, 13, 0.32),
    0 1px 0 #4e0c18,
    0 5px 12px rgba(0, 0, 0, 0.32) !important;
}

/* 次操作按钮：半透明宣纸与细朱砂边 */
.portal-secondary,
.app-shell .secondary-action,
.scene-header-tools button,
.event-photo-button,
.event-panel-handle,
.letter-fold-btn {
  border-color: rgba(255, 221, 210, 0.23) !important;
  color: rgba(255, 246, 239, 0.82) !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 46%),
    rgba(38, 22, 27, 0.66) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 236, 0.07),
    0 2px 0 rgba(9, 3, 5, 0.46),
    0 8px 16px rgba(0, 0, 0, 0.24) !important;
  font-family: var(--portal-kai) !important;
  font-size: 13px !important;
  letter-spacing: 0.055em;
}

.portal-secondary:hover,
.app-shell .secondary-action:hover,
.scene-header-tools button:hover,
.event-photo-button:hover,
.letter-fold-btn:hover {
  border-color: rgba(255, 129, 142, 0.52) !important;
  color: #fff !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.065), transparent 48%),
    rgba(95, 18, 34, 0.7) !important;
}

/* 顶部工具与章节导航 */
.app-shell .tool-button {
  border-top-color: rgba(255, 228, 218, 0.18);
  border-bottom-color: rgba(71, 8, 19, 0.72);
  color: rgba(255, 244, 236, 0.86);
  font-family: var(--portal-sans);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.app-shell .tool-button::before {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: 1px;
  background: linear-gradient(transparent, rgba(230, 57, 70, 0.42), transparent);
  content: "";
  pointer-events: none;
}

.app-shell .chapter-nav button {
  border: 1px solid transparent;
  color: rgba(255, 238, 231, 0.52);
  background: rgba(255, 255, 255, 0.015);
  font-family: var(--portal-serif);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.035em;
}

.app-shell .chapter-nav button:hover {
  color: #fff;
  border-color: rgba(255, 155, 163, 0.18);
  background: rgba(200, 16, 46, 0.08);
}

.app-shell .chapter-nav button.active {
  color: #fff !important;
  border-color: rgba(255, 165, 171, 0.44);
  background:
    linear-gradient(180deg, rgba(230, 57, 70, 0.24), rgba(108, 13, 31, 0.18)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 235, 0.16),
    0 0 0 1px rgba(200, 16, 46, 0.1),
    0 5px 14px rgba(0, 0, 0, 0.24);
}

/* 地图圆形铜章控制 */
.app-shell .map-zoom-controls {
  padding: 5px;
  border: 1px solid rgba(255, 221, 211, 0.12);
  border-radius: 24px;
  background: rgba(12, 7, 9, 0.62);
  backdrop-filter: blur(10px);
}

.app-shell .map-zoom-controls button {
  border-radius: 50%;
  border-color: rgba(255, 215, 203, 0.24);
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 244, 235, 0.14), transparent 38%),
    linear-gradient(180deg, #4b252e, #251219 58%, #130a0e);
  font-family: var(--portal-serif);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.app-shell .map-zoom-controls button.reset {
  color: #ffd6d0;
  font-size: 15px;
}

/* 图层按钮变为嵌入式拨片 */
.war-layer-controls {
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255, 239, 230, 0.06),
    inset 0 -1px 0 rgba(255, 130, 140, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.32);
}

.war-layer-controls button {
  position: relative;
  overflow: hidden;
  color: rgba(255, 236, 229, 0.52);
  font-family: var(--portal-sans);
  letter-spacing: 0.07em;
}

.war-layer-controls button::after {
  position: absolute;
  right: 16%;
  bottom: 3px;
  left: 16%;
  height: 1px;
  background: transparent;
  content: "";
}

.war-layer-controls button.active::after {
  background: linear-gradient(90deg, transparent, #e94a5e, transparent);
  box-shadow: 0 0 7px rgba(230, 57, 70, 0.54);
}

/* 时间控制与播放键 */
.app-shell .icon-action {
  border-radius: 50%;
  border-color: rgba(255, 217, 207, 0.2);
  color: rgba(255, 241, 234, 0.8);
  background: rgba(22, 12, 16, 0.68);
  box-shadow:
    inset 0 1px 0 rgba(255, 243, 236, 0.08),
    0 2px 0 rgba(0, 0, 0, 0.48);
}

.app-shell .icon-action:hover {
  color: #fff;
  border-color: rgba(255, 112, 128, 0.58);
}

.app-shell .play-action {
  border-color: rgba(255, 198, 187, 0.28);
  border-radius: 2px;
  color: #fff4ec;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent),
    rgba(75, 27, 28, 0.76);
  font-family: var(--portal-kai);
  font-size: 12px;
  letter-spacing: 0.07em;
}

/* 档案筛选和标签 */
.archive-drawer .battle-select {
  height: 38px;
  padding: 0 12px;
  border-radius: 2px;
  border-color: rgba(255, 224, 214, 0.16);
  color: #fff4ed;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    #211218;
  font-family: var(--portal-serif);
  font-size: 11px;
}

.archive-drawer .history-tab {
  min-height: 44px;
  font-family: var(--portal-kai);
  letter-spacing: 0.06em;
}

.archive-drawer .battle-result-badge,
.archive-drawer .battle-tag,
.archive-drawer .archive-state {
  font-family: var(--portal-serif);
  letter-spacing: 0.04em;
}

/* 问答和回信内的按键字形 */
.quiz-option,
.quiz-hint-btn,
.today-gate .letter-suggestions button,
.today-gate .letter-actions .portal-primary {
  font-family: var(--portal-kai) !important;
  letter-spacing: 0.035em;
}

.today-gate .letter-suggestions button {
  border-color: rgba(91, 43, 34, 0.24);
  color: rgba(67, 35, 29, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent),
    rgba(248, 240, 227, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

@media (max-width: 760px) {
  .portal-primary,
  .portal-secondary,
  .app-shell .primary-action,
  .app-shell .secondary-action,
  .enter-button,
  .sand-play {
    font-size: 14px !important;
  }

  .app-shell .tool-button {
    min-width: 44px;
    min-height: 44px;
  }

  .app-shell .chapter-nav button {
    min-height: 38px;
  }
}

/* ============================================================
   整体明度提升：保留红黑对比，减少纯黑吞没细节
   ============================================================ */

.portal-home {
  background-color: #181117;
}

.portal-home::before {
  opacity: 0.24;
}

.portal-header {
  background-color: rgba(29, 20, 26, 0.9);
}

.exhibition-card {
  background-color: #221820;
}

.exhibition-sand {
  background-color: #2b1720;
}

.exhibition-stars {
  background-color: #1d151c;
}

.exhibition-chronicle,
.exhibition-archive {
  background-color: #24171d;
}

.exhibition-spirit,
.exhibition-study,
.exhibition-today {
  background-color: #21171d;
}

.portal-footer {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.012), rgba(200, 16, 46, 0.025));
}

.portal-gate-backdrop {
  background-color: rgba(5, 4, 6, 0.78);
}

.login-card,
.directory-sheet,
.spirit-room,
.quiz-card,
.guide-card,
.scene-help-card {
  background-color: #21161d;
}

.app-shell {
  background-color: #171017;
}

.app-shell .topbar {
  background-color: #1b1218;
}

.app-shell .map-panel {
  background-color: #1b1218;
}

.app-shell .time-deck {
  background-color: #1b1218;
}

.app-shell .chronicle {
  background-color: rgba(35, 22, 30, 0.97);
}

.app-shell .map-statline {
  background-color: #20151c;
}

.war-sand-ready .map-frame {
  background-color: #181017;
  box-shadow:
    inset 0 0 0 5px rgba(255, 232, 221, 0.022),
    inset 0 0 64px rgba(0, 0, 0, 0.38),
    0 22px 44px rgba(0, 0, 0, 0.3);
}

.war-terrain-canvas {
  filter: brightness(1.12) saturate(1.04) contrast(0.98);
}

.is-terrain-dragging .war-terrain-canvas {
  filter: brightness(1.18) saturate(1.08) contrast(0.98);
}

.war-terrain-vignette {
  opacity: 0.72;
}

.archive-drawer {
  background-color: #1d1319;
}

.archive-drawer .battle-entry,
.archive-drawer .archive-entry {
  background-color: #23171e;
}

.archive-drawer .battle-entry:hover,
.archive-drawer .archive-entry:hover,
.archive-drawer .battle-entry[open],
.archive-drawer .archive-entry[open] {
  background-color: #2b1821;
}

.event-panel-illustration img {
  filter: sepia(0.12) saturate(0.88) contrast(1.03) brightness(0.98);
}

.app-shell .event-narration {
  color: rgba(255, 248, 242, 0.94);
}

.app-shell .lens-card p {
  color: rgba(255, 247, 241, 0.82);
}

.portal-section-head > p:last-child,
.card-desc,
.portal-lead {
  color: rgba(255, 247, 241, 0.72);
}

.portal-lead {
  color: rgba(255, 249, 244, 0.86);
}

/* ============================================================
   画面切换转场：朱砂帷幕 + 红星聚光
   ============================================================ */

.scene-transition {
  position: fixed;
  inset: 0;
  z-index: 9000;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(9, 5, 8, 0.28);
  transition: opacity 380ms cubic-bezier(0.22, 0.72, 0.2, 1), visibility 380ms ease;
}

.scene-transition.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.scene-transition::before {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(230, 57, 70, 0.17), transparent 27%),
    radial-gradient(circle at 50% 50%, transparent 0 29%, rgba(200, 16, 46, 0.07) 30%, transparent 48%),
    rgba(9, 5, 8, 0.84);
  content: "";
  opacity: 0;
  transform: scale(1.12);
  transition: opacity 480ms ease, transform 920ms cubic-bezier(0.16, 0.76, 0.18, 1);
  backdrop-filter: blur(7px);
}

.scene-transition.active::before {
  opacity: 1;
  transform: scale(1);
}

.transition-ribbon {
  position: absolute;
  top: -12%;
  bottom: -12%;
  width: 52%;
  background:
    linear-gradient(90deg, rgba(92, 7, 23, 0.96), rgba(200, 16, 46, 0.9) 48%, rgba(95, 8, 24, 0.94)),
    repeating-linear-gradient(118deg, transparent 0 18px, rgba(255, 255, 255, 0.04) 19px 20px);
  box-shadow: 0 0 70px rgba(200, 16, 46, 0.28);
  transition: transform 900ms cubic-bezier(0.16, 0.76, 0.18, 1);
}

.ribbon-left {
  left: 0;
  clip-path: polygon(0 0, 100% 0, 88% 50%, 100% 100%, 0 100%);
  transform: translateX(-105%);
}

.ribbon-right {
  right: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12% 50%);
  transform: translateX(105%);
}

.scene-transition.active .ribbon-left,
.scene-transition.active .ribbon-right {
  transform: translateX(0);
}

.transition-core {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 12px;
  min-width: 280px;
  padding: 26px 36px;
  color: #fff5ed;
  border: 1px solid rgba(255, 228, 218, 0.24);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), transparent 46%),
    rgba(25, 8, 14, 0.88);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.56),
    inset 0 0 0 5px rgba(255, 255, 255, 0.018);
  opacity: 0;
  transform: translate(-50%, -46%) scale(0.92);
  transition: opacity 340ms ease 120ms, transform 680ms cubic-bezier(0.16, 0.76, 0.18, 1) 100ms;
}

.scene-transition.active .transition-core {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.transition-star {
  color: #ff465b;
  font-size: 44px;
  line-height: 1;
  filter:
    drop-shadow(0 0 10px rgba(255, 67, 91, 0.75))
    drop-shadow(0 0 26px rgba(200, 16, 46, 0.42));
  animation: transitionStar 1.4s ease-in-out infinite;
}

@keyframes transitionStar {
  50% { transform: scale(0.9) rotate(12deg); opacity: 0.7; }
}

.transition-core small {
  font-family: var(--portal-kai);
  font-size: 14px;
  letter-spacing: 0.16em;
}

.transition-years {
  position: absolute;
  bottom: 8%;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 16px;
  color: rgba(255, 234, 224, 0.48);
  font-family: var(--portal-serif);
  font-size: 10px;
  letter-spacing: 0.13em;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 320ms ease 160ms;
}

.scene-transition.active .transition-years {
  opacity: 1;
}

.transition-years i {
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 122, 136, 0.66), transparent);
}

.scene-transition.leaving::before {
  opacity: 0;
}

.scene-transition.leaving .transition-core {
  opacity: 0;
  transform: translate(-50%, -53%) scale(0.96);
}

.scene-transition.leaving .ribbon-left {
  transform: translateX(-105%);
}

.scene-transition.leaving .ribbon-right {
  transform: translateX(105%);
}

@media (prefers-reduced-motion: reduce) {
  .scene-transition,
  .scene-transition::before,
  .transition-ribbon,
  .transition-core,
  .transition-years {
    transition-duration: 1ms !important;
    animation: none !important;
  }
}

/* ============================================================
   人物星图：深空层次、可点击边界与红星闪烁
   ============================================================ */

.star-stage {
  isolation: isolate;
  background:
    radial-gradient(ellipse at 48% 48%, rgba(101, 13, 34, 0.2), transparent 44%),
    radial-gradient(ellipse at 18% 20%, rgba(124, 24, 48, 0.08), transparent 28%),
    linear-gradient(150deg, #0f0a0e, #171016 52%, #0b080c);
}

.star-stage::before {
  position: absolute;
  inset: 7%;
  z-index: 0;
  border: 1px solid rgba(255, 218, 211, 0.045);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%, transparent 0 58px, rgba(255, 230, 223, 0.025) 59px 60px),
    conic-gradient(
      from 20deg,
      transparent,
      rgba(200, 16, 46, 0.055),
      transparent 14%,
      transparent 42%,
      rgba(245, 239, 230, 0.025),
      transparent 58%
    );
  content: "";
  pointer-events: none;
  transform: rotate(-8deg) scaleY(0.78);
}

.star-stage::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(7, 4, 7, 0.42), transparent 14%, transparent 84%, rgba(7, 4, 7, 0.42)),
    linear-gradient(0deg, rgba(7, 4, 7, 0.42), transparent 14%, transparent 84%, rgba(7, 4, 7, 0.3));
  content: "";
  pointer-events: none;
}

.star-stage canvas {
  z-index: 1;
  cursor: grab;
}

.star-stage canvas:active {
  cursor: grabbing;
}

.star-nebula,
.star-center-mark {
  z-index: 1;
}

.star-controls {
  z-index: 8;
  padding: 5px;
  border: 1px solid rgba(255, 219, 210, 0.13);
  background: rgba(18, 10, 14, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 243, 235, 0.055),
    0 10px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.star-controls label {
  height: 38px;
  border-color: rgba(255, 216, 207, 0.15);
  background: rgba(255, 255, 255, 0.025);
}

.star-controls label:focus-within {
  border-color: rgba(255, 111, 128, 0.55);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}

.star-controls input {
  color: #fff6ef;
  font-size: 11px;
}

.star-controls > button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border-color: rgba(255, 215, 205, 0.18);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.12), transparent 41%),
    rgba(45, 22, 30, 0.9);
  font-family: var(--portal-serif);
}

.star-index {
  border-left-color: rgba(255, 116, 132, 0.22);
  background:
    linear-gradient(180deg, rgba(200, 16, 46, 0.075), transparent 24%),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(255, 255, 255, 0.014) 35px),
    #171015;
}

.star-index header {
  padding-top: 3px;
}

.star-index header::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(230, 57, 70, 0.56), transparent);
  content: "";
}

.star-index-filter button {
  min-height: 30px;
  border-radius: 1px;
  font-family: var(--portal-serif);
}

.star-index-filter button.active {
  color: #fff;
  border-color: rgba(255, 126, 140, 0.55);
  background:
    linear-gradient(180deg, rgba(230, 57, 70, 0.25), rgba(104, 15, 33, 0.16));
  box-shadow: inset 0 1px 0 rgba(255, 239, 233, 0.1);
}

.star-list button {
  min-height: 52px;
  border-bottom-color: rgba(255, 231, 223, 0.075);
  background: linear-gradient(90deg, transparent, transparent);
  transition: color 160ms ease, background 160ms ease, padding-left 160ms ease;
}

.star-list button:hover,
.star-list button.active {
  padding-left: 9px;
  background:
    linear-gradient(90deg, rgba(200, 16, 46, 0.18), rgba(200, 16, 46, 0.025) 58%, transparent);
}

.star-list button.active strong {
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 91, 109, 0.3);
}

.star-profile {
  z-index: 10;
  border-color: rgba(255, 112, 129, 0.5);
  background:
    radial-gradient(circle at 10% 20%, rgba(230, 57, 70, 0.15), transparent 36%),
    rgba(22, 13, 18, 0.97);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.74),
    inset 0 0 0 5px rgba(255, 255, 255, 0.018),
    0 0 30px rgba(200, 16, 46, 0.12);
}

.star-profile::before {
  position: absolute;
  inset: 7px;
  z-index: 0;
  border: 1px solid rgba(255, 218, 209, 0.055);
  content: "";
  pointer-events: none;
}

.star-profile-close {
  width: 36px;
  height: 36px;
  border-color: rgba(255, 220, 211, 0.18);
  color: rgba(255, 246, 239, 0.8);
}

.star-profile-close:hover {
  border-color: rgba(255, 100, 117, 0.62);
  background: rgba(200, 16, 46, 0.16);
}

.star-intro {
  z-index: 6;
  border-color: rgba(255, 113, 129, 0.28);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.58),
    inset 0 0 0 5px rgba(255, 255, 255, 0.014);
}

/* 马灯点击后由暗到亮的点火效果 */
.spirit-lamp {
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 31%, rgba(200, 16, 46, 0.025), transparent 31%),
    rgba(255, 255, 255, 0.015);
  transition:
    border-color 240ms ease,
    background 360ms ease,
    box-shadow 360ms ease,
    transform 200ms ease;
}

.spirit-lamp::before {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: -1;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 104, 105, 0.32), transparent 66%);
  content: "";
  opacity: 0;
  transform: translateX(-50%) scale(0.45);
  transition: opacity 420ms ease, transform 520ms cubic-bezier(0.16, 0.76, 0.18, 1);
}

.spirit-lamp i {
  color: rgba(178, 48, 62, 0.42);
  border-color: rgba(255, 218, 210, 0.1);
  background:
    radial-gradient(circle at 50% 42%, rgba(112, 22, 37, 0.12), transparent 62%),
    rgba(4, 2, 4, 0.35);
  box-shadow: inset 0 0 9px rgba(0, 0, 0, 0.4);
  transition:
    color 280ms ease,
    background 350ms ease,
    border-color 300ms ease,
    box-shadow 420ms ease,
    transform 420ms cubic-bezier(0.16, 0.76, 0.18, 1);
}

.spirit-lamp strong {
  color: rgba(255, 236, 228, 0.5);
  transition: color 260ms ease, text-shadow 360ms ease;
}

.spirit-lamp.active {
  color: #fff8f1;
  border-color: rgba(255, 118, 129, 0.58);
  background:
    radial-gradient(circle at 50% 34%, rgba(230, 57, 70, 0.21), transparent 39%),
    linear-gradient(180deg, rgba(200, 16, 46, 0.14), rgba(55, 12, 21, 0.09));
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 233, 0.1),
    0 10px 26px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(200, 16, 46, 0.1);
}

.spirit-lamp.active::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.spirit-lamp.active i {
  color: #fff7ed;
  border-color: rgba(255, 188, 168, 0.56);
  background:
    radial-gradient(circle, rgba(255, 103, 96, 0.58), rgba(159, 21, 38, 0.24) 58%, transparent 72%);
  box-shadow:
    inset 0 0 13px rgba(255, 177, 153, 0.34),
    0 0 14px rgba(255, 74, 85, 0.72),
    0 0 34px rgba(230, 57, 70, 0.34);
}

.spirit-lamp.active strong {
  color: #fff7f0;
  text-shadow: 0 0 13px rgba(255, 101, 92, 0.31);
}

.spirit-lamp.active small {
  color: rgba(255, 220, 207, 0.5);
}

.spirit-lamp.igniting i {
  animation: lampIgnite 760ms cubic-bezier(0.18, 0.76, 0.18, 1);
}

.spirit-lamp.igniting {
  animation: lampSurfaceIgnite 760ms ease-out;
}

@keyframes lampIgnite {
  0% { filter: brightness(0.65); transform: scale(0.88); }
  25% { filter: brightness(2.25); transform: scale(1.13); }
  58% { filter: brightness(1.6); transform: scale(1.04); }
  100% { filter: brightness(1.2); transform: scale(1); }
}

@keyframes lampSurfaceIgnite {
  0% { box-shadow: 0 0 0 rgba(255, 96, 105, 0); }
  28% {
    box-shadow:
      0 0 18px rgba(255, 96, 105, 0.32),
      0 0 42px rgba(230, 57, 70, 0.2);
  }
  100% {
    box-shadow:
      0 10px 26px rgba(0, 0, 0, 0.28),
      0 0 24px rgba(200, 16, 46, 0.1);
  }
}

.spirit-reading {
  border-left-color: rgba(255, 83, 101, 0.78);
  background:
    linear-gradient(90deg, rgba(200, 16, 46, 0.11), transparent 62%),
    rgba(255, 255, 255, 0.014);
  transition: background 300ms ease;
}

@media (max-width: 760px) {
  .star-controls {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .star-profile {
    z-index: 10;
  }

  .star-stage::before {
    inset: 4%;
  }
}

/* ============================================================
   山河卷轴转场：木轴展开宣纸手卷
   ============================================================ */

.scene-transition {
  --scroll-half: min(450px, 43vw);
  background: rgba(8, 5, 7, 0.6);
  backdrop-filter: blur(5px);
}

.scene-transition::before {
  background:
    radial-gradient(circle at 50% 50%, rgba(98, 23, 37, 0.17), transparent 40%),
    linear-gradient(90deg, rgba(6, 3, 5, 0.62), transparent 18%, transparent 82%, rgba(6, 3, 5, 0.62));
  transform: none;
}

.scroll-paper {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  width: calc(var(--scroll-half) * 2);
  max-width: 86vw;
  height: clamp(205px, 32vh, 310px);
  overflow: hidden;
  color: #47231f;
  border-top: 1px solid rgba(109, 61, 42, 0.28);
  border-bottom: 1px solid rgba(109, 61, 42, 0.28);
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.7), transparent 27%),
    linear-gradient(90deg, rgba(130, 75, 50, 0.12), transparent 7%, transparent 93%, rgba(130, 75, 50, 0.13)),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(90, 54, 38, 0.055) 28px),
    #e7dac5;
  box-shadow:
    inset 0 0 50px rgba(74, 37, 26, 0.12),
    0 30px 70px rgba(0, 0, 0, 0.54);
  opacity: 0;
  transform: translate(-50%, -50%) perspective(1200px) rotateX(-8deg) scaleX(0.015);
  transform-origin: center;
  transition:
    transform 920ms cubic-bezier(0.16, 0.76, 0.18, 1),
    opacity 280ms ease;
}

.scroll-paper::before {
  position: absolute;
  inset: 11px;
  z-index: 2;
  border: 1px solid rgba(136, 77, 51, 0.2);
  box-shadow: inset 0 0 0 3px rgba(255, 251, 240, 0.15);
  content: "";
  pointer-events: none;
}

.scroll-paper::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 2;
  width: 1px;
  background: linear-gradient(transparent, rgba(101, 55, 39, 0.16), transparent);
  content: "";
  pointer-events: none;
}

.scene-transition.active .scroll-paper {
  opacity: 1;
  transform: translate(-50%, -50%) perspective(1200px) rotateX(0deg) scaleX(1);
}

.scene-transition.leaving .scroll-paper {
  opacity: 0.15;
  transform: translate(-50%, -50%) perspective(1200px) rotateX(8deg) scaleX(0.012);
}

.scroll-landscape {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 67%;
  opacity: 0;
  transition: opacity 500ms ease 330ms;
}

.scene-transition.active .scroll-landscape {
  opacity: 1;
}

.scroll-mountain-far {
  fill: rgba(82, 71, 67, 0.19);
}

.scroll-mountain-near {
  fill: rgba(52, 46, 44, 0.32);
}

.scroll-river {
  fill: none;
  stroke: rgba(132, 167, 166, 0.45);
  stroke-width: 2;
}

.transition-core {
  position: absolute;
  top: 42%;
  left: 50%;
  z-index: 4;
  display: grid;
  min-width: 0;
  padding: 0;
  place-items: center;
  gap: 9px;
  color: #5a1719;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  transform: translate(-50%, -42%);
  transition: opacity 380ms ease 360ms, transform 500ms ease 330ms;
}

.scene-transition.active .transition-core {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.scene-transition.leaving .transition-core {
  opacity: 0;
  transform: translate(-50%, -55%);
}

.scroll-eyebrow {
  color: rgba(127, 34, 29, 0.62);
  font-family: var(--portal-sans);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.22em;
}

.transition-core strong {
  color: #8f1823;
  background: linear-gradient(180deg, #77111c, #b51730 62%, #dc4652);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: var(--portal-kai);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 rgba(255, 250, 238, 0.5);
}

.transition-years {
  position: static;
  display: flex;
  gap: 12px;
  color: rgba(92, 45, 37, 0.54);
  font-size: 8px;
  opacity: 0;
  transform: none;
  transition: opacity 360ms ease 520ms;
}

.scene-transition.active .transition-years {
  opacity: 1;
}

.transition-years i {
  width: 34px;
  background: linear-gradient(90deg, transparent, rgba(140, 28, 19, 0.42), transparent);
}

.scroll-seal {
  position: absolute;
  right: 34px;
  bottom: 28px;
  z-index: 4;
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  color: #fff1e5;
  border: 2px solid rgba(255, 230, 215, 0.42);
  background: #a4161a;
  font-family: var(--portal-kai);
  font-size: 18px;
  box-shadow: 0 5px 12px rgba(80, 9, 14, 0.35);
  opacity: 0;
  transform: rotate(-12deg) scale(0.65);
  transition: opacity 340ms ease 620ms, transform 460ms cubic-bezier(0.18, 0.74, 0.18, 1) 600ms;
}

.scene-transition.active .scroll-seal {
  opacity: 1;
  transform: rotate(-6deg) scale(1);
}

.scroll-caption {
  position: absolute;
  bottom: 28px;
  left: 34px;
  z-index: 4;
  color: rgba(82, 46, 37, 0.45);
  font-family: var(--portal-kai);
  font-size: 10px;
  letter-spacing: 0.15em;
  opacity: 0;
  transition: opacity 300ms ease 600ms;
}

.scene-transition.active .scroll-caption {
  opacity: 1;
}

.scroll-roller {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 23px;
  height: min(390px, 42vh);
  border: 1px solid rgba(246, 212, 175, 0.36);
  border-radius: 13px;
  background:
    linear-gradient(90deg, #3b1c13, #8b5737 35%, #c09062 52%, #704027 72%, #32160f);
  box-shadow:
    inset 0 0 0 3px rgba(48, 20, 13, 0.2),
    0 16px 32px rgba(0, 0, 0, 0.5);
  transition:
    left 920ms cubic-bezier(0.16, 0.76, 0.18, 1),
    right 920ms cubic-bezier(0.16, 0.76, 0.18, 1),
    transform 920ms cubic-bezier(0.16, 0.76, 0.18, 1),
    opacity 240ms ease;
}

.scroll-roller::before,
.scroll-roller::after {
  position: absolute;
  left: -7px;
  width: 35px;
  height: 17px;
  border-radius: 50%;
  background: linear-gradient(90deg, #3b1c13, #b27c50 44%, #e1b786 54%, #6b3b25 78%);
  content: "";
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.36);
}

.scroll-roller::before {
  top: -4px;
}

.scroll-roller::after {
  bottom: -4px;
}

.scroll-roller-left {
  left: 50%;
  transform: translate(-100%, -50%);
}

.scroll-roller-right {
  left: 50%;
  transform: translate(0, -50%);
}

.scene-transition.active .scroll-roller-left {
  left: calc(50% - var(--scroll-half));
}

.scene-transition.active .scroll-roller-right {
  left: calc(50% + var(--scroll-half));
}

.scene-transition.leaving .scroll-roller-left {
  left: 50%;
  opacity: 0.35;
}

.scene-transition.leaving .scroll-roller-right {
  left: 50%;
  opacity: 0.35;
}

@media (max-width: 760px) {
  .scene-transition {
    --scroll-half: 45vw;
  }

  .scroll-paper {
    height: 220px;
  }

  .transition-core strong {
    font-size: 20px;
  }

  .scroll-roller {
    height: 270px;
    width: 19px;
  }

  .scroll-caption {
    bottom: 18px;
    left: 24px;
    font-size: 8px;
  }

  .scroll-seal {
    right: 24px;
    bottom: 18px;
    width: 36px;
    height: 36px;
    font-size: 15px;
  }
}

/* ============================================================
   按钮个性化系统：漆印、描边、卷宗章与微交互
   ============================================================ */

button[data-glyph]::after {
  position: absolute;
  right: 7px;
  bottom: 4px;
  z-index: 3;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: rgba(255, 226, 217, 0.5);
  border: 1px solid rgba(255, 214, 204, 0.17);
  border-radius: 50%;
  background: rgba(42, 10, 18, 0.34);
  content: attr(data-glyph);
  font-family: var(--portal-kai);
  font-size: 8px;
  font-style: normal;
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

button[data-glyph]:hover::after {
  color: #fff8f2;
  border-color: rgba(255, 126, 139, 0.48);
  transform: rotate(-8deg) scale(1.08);
}

.app-shell .tool-button[data-glyph] {
  padding-right: 28px;
}

.app-shell .tool-button[data-glyph]::after {
  top: 50%;
  right: 7px;
  bottom: auto;
  color: rgba(255, 148, 159, 0.7);
  border-color: rgba(230, 57, 70, 0.24);
  background: rgba(200, 16, 46, 0.08);
  transform: translateY(-50%);
}

.app-shell .tool-button[data-glyph]:hover::after {
  transform: translateY(-50%) rotate(-7deg) scale(1.06);
}

.button-lacquer {
  padding-right: 39px !important;
}

.button-lacquer[data-glyph]::after {
  top: 7px;
  right: 7px;
  bottom: auto;
  width: 19px;
  height: 19px;
  color: #ffe8d8;
  border-color: rgba(255, 228, 208, 0.35);
  background: rgba(76, 4, 16, 0.34);
  font-size: 9px;
}

.button-paper {
  padding-right: 35px !important;
}

.button-paper[data-glyph]::after {
  top: 50%;
  right: 9px;
  bottom: auto;
  color: rgba(255, 147, 157, 0.75);
  border-color: rgba(255, 117, 132, 0.2);
  transform: translateY(-50%);
}

.button-refined {
  box-shadow:
    inset 2px 0 0 rgba(230, 57, 70, 0.18),
    inset 0 1px 0 rgba(255, 245, 237, 0.06),
    0 2px 0 rgba(0, 0, 0, 0.42) !important;
}

.button-refined:hover {
  box-shadow:
    inset 3px 0 0 rgba(230, 57, 70, 0.42),
    inset 0 1px 0 rgba(255, 245, 237, 0.08),
    0 5px 14px rgba(0, 0, 0, 0.28) !important;
}

/* 热门按钮设计中常见的“填充扫描”和“文字上浮” */
.button-paper::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 239, 230, 0.07) 46%, transparent 70%);
  content: "";
  pointer-events: none;
  transform: translateX(-110%);
  transition: transform 480ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.button-paper:hover::before {
  transform: translateX(110%);
}

.button-paper > span,
.button-refined > span,
.button-lacquer > span {
  position: relative;
  z-index: 2;
}

.button-paper:hover > span,
.button-paper:hover > strong,
.button-refined:hover > span,
.button-lacquer:hover > span {
  transform: translateY(-1px);
}

/* 放大按钮字样，保持各类层级 */
.portal-primary,
.portal-secondary,
.app-shell .primary-action,
.app-shell .secondary-action,
.enter-button {
  font-size: 16px !important;
}

.app-shell .tool-button {
  font-size: 13px !important;
}

.app-shell .chapter-nav button {
  font-size: 11px !important;
}

.app-shell .play-action {
  font-size: 13px !important;
}

.app-shell .icon-action {
  font-size: 17px !important;
}

.archive-drawer .history-tab {
  font-size: 13px !important;
}

.archive-drawer .battle-select {
  font-size: 12px !important;
}

.archive-drawer .battle-result-badge,
.archive-drawer .battle-tag,
.archive-drawer .archive-state {
  font-size: 10px !important;
}

.quiz-option .option-copy {
  font-size: 16px !important;
}

.quiz-hint-btn span {
  font-size: 14px !important;
}

.spirit-lamp strong {
  font-size: 15px !important;
}

.star-list button strong {
  font-size: 15.5px !important;
}

.star-index-filter button {
  font-size: 9.5px !important;
}

.scene-back {
  font-size: 12px !important;
}

.scene-header-tools button {
  font-size: 10.5px !important;
}

.letter-fold-btn,
.today-gate .letter-suggestions button {
  font-size: 10px !important;
}

.app-shell .event-photo-button,
.app-shell .chronicle-actions button {
  font-size: 12px !important;
}

@media (max-width: 760px) {
  .portal-primary,
  .portal-secondary,
  .app-shell .primary-action,
  .app-shell .secondary-action,
  .enter-button {
    font-size: 15px !important;
  }

  .app-shell .tool-button,
  .app-shell .chapter-nav button,
  .archive-drawer .history-tab {
    font-size: 12px !important;
  }

  button[data-glyph]::after {
    width: 18px;
    height: 18px;
    font-size: 8.5px;
  }
}
