*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #2b3140 0, #080b10 55%, #050608 100%);
  color: #f5f5f5;
}

.app {
  /* 为三栏留出空间，使中间 5×5 可达 min(80dvh, 栏宽) 而不被 1200px 卡死 */
  max-width: min(1720px, 100%);
  margin: 0 auto;
  padding: 8px 12px 10px;
  box-sizing: border-box;
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #a8d4f0;
  text-align: center;
  flex-shrink: 0;
}

/* 状态 / 消耗：左侧栏 .hud-panel 内纵向堆叠 */
.top-bar-block {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-panel .top-bar-block {
  flex: 0 0 auto;
  min-width: 0;
  width: 100%;
}

.grid-hud-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  flex-shrink: 0;
  align-self: stretch;
}

.grid-hud-stack .grid-hud-block {
  flex: none;
  min-width: 0;
}

.top-bar-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.top-bar-stats {
  background: linear-gradient(135deg, rgba(30, 45, 70, 0.95), rgba(15, 22, 38, 0.95));
  border: 1px solid rgba(80, 140, 200, 0.4);
  border-left: 3px solid #5b9bd5;
}

.top-bar-costs {
  background: linear-gradient(135deg, rgba(40, 35, 55, 0.95), rgba(20, 18, 30, 0.95));
  border: 1px solid rgba(140, 100, 180, 0.4);
  border-left: 3px solid #9b7bb8;
}

/* 须高于 .modal（z-index:50），否则商店/炼金等全屏弹窗会挡住暂停、上一步、下一步 */
.replay-banner {
  position: relative;
  z-index: 60;
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  background: linear-gradient(90deg, rgba(90, 70, 40, 0.55), rgba(50, 40, 24, 0.72));
  border: 1px solid rgba(220, 180, 100, 0.45);
  color: #f8ecd0;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
}

.replay-banner-text {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
}

.replay-banner-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.replay-banner-controls.hidden {
  display: none;
}

.btn-replay-ctrl {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid rgba(200, 200, 200, 0.35);
  background: rgba(35, 40, 48, 0.92);
  color: #e8e8ec;
}

.btn-replay-ctrl:hover:not(:disabled) {
  border-color: rgba(255, 220, 160, 0.45);
  color: #fff8ec;
}

.btn-replay-ctrl:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-replay-stop {
  flex-shrink: 0;
  padding: 4px 12px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid rgba(255, 200, 140, 0.55);
  background: rgba(40, 28, 18, 0.9);
  color: #ffe8c8;
}

/* .top-bar-controls 已移除对应 HTML 块 */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
}

.stat {
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 500;
}

.stat-day {
  background: rgba(60, 90, 130, 0.5);
}

.stat-sanity {
  background: rgba(100, 80, 140, 0.5);
}

.stat-gold {
  background: rgba(140, 110, 50, 0.5);
}

#gold.goldLossFlash {
  animation: goldLossFlash 0.6s ease-out;
}

@keyframes goldLossFlash {
  0% {
    transform: scale(1);
    color: #d8f3ff;
    text-shadow: none;
  }
  30% {
    transform: scale(1.12);
    color: #ff6b6b;
    text-shadow: 0 0 10px rgba(255, 80, 80, 0.7);
  }
  100% {
    transform: scale(1);
    color: #d8f3ff;
    text-shadow: none;
  }
}

/* 穷苦之碑扣金：全屏阴翳 + 提示文案 + 界面微颤 */
.poverty-hit-overlay {
  position: fixed;
  inset: 0;
  z-index: 44;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease-out,
    visibility 0.2s ease-out;
}

.poverty-hit-overlay.poverty-hit--on {
  opacity: 1;
  visibility: visible;
}

.poverty-hit-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 72% 58% at 50% 48%, rgba(35, 55, 28, 0) 0%, rgba(18, 32, 20, 0.55) 45%, rgba(8, 14, 10, 0.88) 100%),
    radial-gradient(ellipse 100% 100% at 50% 0%, rgba(60, 25, 35, 0.35) 0%, transparent 42%);
  filter: saturate(0.85) contrast(1.08);
}

.poverty-hit-overlay.poverty-hit--on .poverty-hit-vignette {
  animation: povertyVignetteDrain 1.05s ease-out forwards;
}

@keyframes povertyVignetteDrain {
  0% {
    opacity: 0;
  }
  22% {
    opacity: 1;
  }
  55% {
    opacity: 0.92;
  }
  100% {
    opacity: 0;
  }
}

.poverty-hit-sheen {
  position: absolute;
  inset: 0;
  box-shadow:
    inset 0 0 80px rgba(120, 30, 45, 0.25),
    inset 0 0 0 1px rgba(200, 60, 70, 0.15);
  opacity: 0;
}

.poverty-hit-overlay.poverty-hit--on .poverty-hit-sheen {
  animation: povertySheen 1s ease-out forwards;
}

@keyframes povertySheen {
  0% {
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  40% {
    opacity: 0.65;
    box-shadow:
      inset 0 0 100px rgba(160, 40, 55, 0.35),
      inset 0 0 0 2px rgba(255, 100, 90, 0.28);
  }
  100% {
    opacity: 0;
  }
}

.poverty-hit-float {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 420px);
  padding: 12px 20px;
  text-align: center;
  font-size: clamp(17px, 3.8vw, 26px);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.35;
  color: #ffb8b8;
  text-shadow:
    0 0 22px rgba(180, 30, 50, 0.95),
    0 0 4px rgba(40, 8, 12, 1),
    0 2px 0 rgba(20, 6, 8, 0.9);
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(45, 12, 18, 0.88) 0%, rgba(22, 8, 12, 0.92) 100%);
  border: 1px solid rgba(200, 70, 80, 0.45);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(120, 25, 40, 0.35);
  opacity: 0;
  transform: translateY(18px) scale(0.94);
}

.poverty-hit-overlay.poverty-hit--on .poverty-hit-float {
  animation: povertyFloatReveal 1.12s ease-out forwards;
}

@keyframes povertyFloatReveal {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.92);
  }
  18% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  52% {
    opacity: 1;
    transform: translateY(-6px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-22px) scale(0.97);
  }
}

body.poverty-hit-shake .app {
  animation: povertyScreenShake 0.52s ease-out;
}

@keyframes povertyScreenShake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  18% {
    transform: translate(-3px, 2px);
  }
  36% {
    transform: translate(3px, -2px);
  }
  54% {
    transform: translate(-2px, -2px);
  }
  72% {
    transform: translate(2px, 1px);
  }
}

.stat-gold.stat-gold-poverty-hit {
  animation: statGoldPovertyPulse 0.85s ease-out;
}

@keyframes statGoldPovertyPulse {
  0%,
  100% {
    box-shadow: none;
    border-color: transparent;
  }
  25% {
    box-shadow:
      0 0 0 2px rgba(220, 70, 80, 0.65),
      0 0 18px rgba(200, 50, 60, 0.45);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(255, 100, 90, 0.5),
      0 0 24px rgba(180, 40, 50, 0.4);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.poverty-hit-shake .app {
    animation: none;
  }

  .poverty-hit-overlay.poverty-hit--on .poverty-hit-vignette,
  .poverty-hit-overlay.poverty-hit--on .poverty-hit-sheen,
  .poverty-hit-overlay.poverty-hit--on .poverty-hit-float {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .poverty-hit-overlay.poverty-hit--on .poverty-hit-vignette {
    opacity: 0.75;
  }

  .stat-gold.stat-gold-poverty-hit {
    animation: none;
    outline: 2px solid rgba(220, 80, 90, 0.6);
    outline-offset: 2px;
  }
}

.costs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: #d0e4ff;
}

.hint-icon {
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(130, 200, 255, 0.25);
  border: 1px solid rgba(130, 200, 255, 0.55);
  cursor: help;
}

.hint-icon.hidden {
  display: none;
}

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

button {
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid rgba(130, 200, 255, 0.6);
  background: linear-gradient(135deg, #23324a, #1b2738);
  color: #e9f6ff;
  padding: 6px 12px;
  font-size: 13px;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, opacity 0.1s ease;
}

button:hover:not(:disabled) {
  background: linear-gradient(135deg, #304666, #24354b);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

button,
button * {
  -webkit-tap-highlight-color: transparent;
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

.main-layout {
  flex: 1 1 0;
  min-height: 0;
  margin-top: 8px;
  display: grid;
  /* 左「状态与效果」与右「食物、旧物与日志」同宽 */
  --layout-side-col: minmax(180px, min(297px, 28.35vw));
  grid-template-columns: var(--layout-side-col) minmax(0, 1fr) var(--layout-side-col);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  overflow: hidden;
}

.main-layout > .hud-panel,
.main-layout > .grid-section,
.main-layout > .side-panel {
  min-height: 0;
  max-height: 100%;
}

/* 1）状态与效果 */
.hud-panel {
  padding: 12px 11px 14px;
  border-radius: 12px;
  background:
    radial-gradient(ellipse 120% 80% at 0% 0%, rgba(70, 120, 200, 0.12), transparent 52%),
    radial-gradient(ellipse 90% 70% at 100% 100%, rgba(120, 90, 180, 0.1), transparent 50%),
    linear-gradient(180deg, rgba(14, 20, 32, 0.99), rgba(7, 11, 18, 0.98));
  border: 1px solid rgba(110, 160, 220, 0.45);
  border-top: 3px solid rgba(100, 160, 220, 0.65);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.hud-panel-head {
  flex-shrink: 0;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(110, 160, 220, 0.22);
}

.hud-panel-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #b8def8;
  text-shadow: 0 0 20px rgba(100, 170, 255, 0.2);
}

.hud-panel-body {
  flex: 0 0 auto;
  padding: 11px 9px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(80, 120, 180, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.hud-panel .grid-hud-stack {
  gap: 10px;
}

.hud-panel .top-bar-block {
  padding: 11px 10px 12px;
}

.hud-panel-tail {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;
  padding: 8px 8px 10px 10px;
  border-radius: 0 4px 4px 0;
  border: none;
  border-left: 3px solid rgba(120, 150, 190, 0.35);
  border-bottom: 1px dotted rgba(100, 130, 170, 0.22);
  background: rgba(12, 18, 28, 0.25);
  font-family:
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(200, 210, 228, 0.9);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 160, 220, 0.35) rgba(0, 0, 0, 0.2);
}

.hud-guide-title {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  background: rgba(80, 120, 200, 0.55);
  color: rgba(248, 250, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  min-width: 36px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hud-guide-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 与 .log-entry.tag-* 同色系：左条 + 底纹 + 正文色 */
.hud-guide-item,
.hud-guide-subitem {
  padding: 4px 6px 4px 8px;
  margin: 2px 0;
  border-bottom: 1px dotted rgba(100, 130, 170, 0.22);
  border-left: 3px solid rgba(120, 150, 190, 0.35);
  border-radius: 0 4px 4px 0;
  font-size: 11px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hud-guide-item strong,
.hud-guide-subitem strong {
  font-weight: 600;
}

.hud-guide-sublist {
  margin: 6px 0 2px;
  padding: 0;
  list-style: none;
}

.hud-guide-subitem {
  font-size: 10.5px;
  margin-top: 4px;
}

.hud-guide-item.tag-探索 {
  border-left-color: #4ec8f0;
  background: linear-gradient(90deg, rgba(25, 55, 85, 0.45) 0%, rgba(14, 20, 32, 0.18) 100%);
  color: #6ee0ff;
  text-shadow: 0 0 8px rgba(60, 180, 230, 0.35);
}

.hud-guide-item.tag-石碑,
.hud-guide-subitem.tag-石碑 {
  border-left-color: #e04558;
  background: linear-gradient(90deg, rgba(90, 22, 32, 0.5) 0%, rgba(20, 14, 20, 0.2) 100%);
  border-bottom-color: rgba(140, 40, 55, 0.35);
  color: #ff8a95;
  text-shadow:
    0 0 12px rgba(200, 40, 60, 0.55),
    0 0 1px rgba(60, 10, 20, 0.9);
}

.hud-guide-item.tag-银行 {
  border-left-color: #ffcc55;
  background: linear-gradient(90deg, rgba(85, 65, 25, 0.4) 0%, rgba(18, 16, 12, 0.14) 100%);
  color: #ffe066;
  text-shadow: 0 0 8px rgba(255, 200, 80, 0.25);
}

.hud-guide-item.tag-疗养院 {
  border-left-color: #5fe8b8;
  background: linear-gradient(90deg, rgba(28, 85, 65, 0.4) 0%, rgba(12, 22, 20, 0.14) 100%);
  color: #7fffd4;
  text-shadow: 0 0 6px rgba(80, 220, 170, 0.22);
}

.hud-guide-item.tag-故事 {
  border-left-color: #c8a8e8;
  background: linear-gradient(90deg, rgba(55, 42, 75, 0.38) 0%, rgba(16, 14, 22, 0.12) 100%);
  color: #e8d8ff;
  font-style: italic;
  font-weight: 500;
  text-shadow: 0 0 6px rgba(180, 150, 230, 0.15);
}

.hud-guide-item.tag-食物 {
  border-left-color: #7fd968;
  background: linear-gradient(90deg, rgba(35, 70, 40, 0.42) 0%, rgba(14, 22, 18, 0.15) 100%);
  color: #b8f090;
  text-shadow: 0 0 6px rgba(100, 200, 80, 0.22);
}

.hud-guide-item.tag-旧物 {
  border-left-color: #e8a855;
  background: linear-gradient(90deg, rgba(75, 52, 28, 0.42) 0%, rgba(18, 16, 14, 0.15) 100%);
  color: #ffd49a;
  text-shadow: 0 0 6px rgba(230, 160, 80, 0.2);
}

.hud-guide-item.tag-商店 {
  border-left-color: #d080ff;
  background: linear-gradient(90deg, rgba(65, 42, 95, 0.42) 0%, rgba(16, 12, 22, 0.14) 100%);
  color: #e8b8ff;
  text-shadow: 0 0 8px rgba(200, 120, 255, 0.2);
}

.hud-guide-item.tag-炼金 {
  border-left-color: #b868ff;
  background: linear-gradient(90deg, rgba(55, 32, 95, 0.45) 0%, rgba(14, 12, 22, 0.15) 100%);
  color: #d8a8ff;
  text-shadow: 0 0 8px rgba(160, 100, 255, 0.22);
}

.hud-guide-item.tag-钥匙 {
  border-left-color: #f0c060;
  background: linear-gradient(90deg, rgba(75, 58, 28, 0.4) 0%, rgba(18, 16, 12, 0.14) 100%);
  color: #ffd080;
  text-shadow: 0 0 6px rgba(255, 190, 100, 0.2);
}

.hud-guide-item.tag-哨塔 {
  border-left-color: #ff9a55;
  background: linear-gradient(90deg, rgba(55, 52, 48, 0.42) 0%, rgba(14, 14, 16, 0.14) 100%);
  color: #ffc090;
  text-shadow: 0 0 6px rgba(255, 150, 90, 0.18);
}

.hud-panel-tail::-webkit-scrollbar {
  width: 6px;
}

.hud-panel-tail::-webkit-scrollbar-thumb {
  background: rgba(110, 160, 220, 0.35);
  border-radius: 3px;
}

.hud-panel .stats {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  font-size: 12px;
}

.hud-panel .stat {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
}

.hud-panel .costs {
  gap: 6px;
}

.hud-cost-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(28, 36, 56, 0.55);
  border: 1px solid rgba(100, 140, 200, 0.15);
  line-height: 1.35;
}

.section-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.section-title-grid {
  color: #7eb8e8;
  padding-bottom: 10px;
  margin-bottom: 0;
  border-bottom: 2px solid rgba(110, 160, 220, 0.5);
}

.grid-section {
  padding: 10px 12px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(12, 18, 28, 0.98), rgba(8, 12, 20, 0.98));
  border: 1px solid rgba(110, 160, 220, 0.5);
  border-top: 3px solid rgba(100, 160, 220, 0.6);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* 2）中间 5×5：棋盘 #grid 本体边长 = min(视口高 80%, 中间栏内容宽)，与外层 .grid-section 是否撑满无关 */
.grid-section--play {
  min-height: 0;
  padding-inline: 8px;
}

.grid-column {
  width: min(96vw, 80dvh);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-height: 0;
}

.grid-column--center {
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.grid-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
}

/* 上行状态文案 + 下行棋盘：第二行 minmax(0,1fr) 给出确定高度，棋盘 max-height:100% 才能压住「顶栏占高后仍强行 80dvh」的裁切 */
.grid-wrapper--play {
  flex: 1 1 0;
  width: 100%;
  max-height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  gap: 6px;
}

.grid-wrapper--play .status-text {
  grid-row: 1;
  justify-self: center;
  width: 100%;
  text-align: center;
}

/* 5×5：边长不超过 80dvh，且不超过中间栏内可用矩形（避免顶栏等挤占高度后裁切） */
.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: min(1.25dvh, 12px);
  box-sizing: border-box;
  grid-row: 2;
  align-self: center;
  justify-self: center;
  width: min(80dvh, 100%);
  max-width: 100%;
  max-height: min(80dvh, 100%);
  aspect-ratio: 1;
  height: auto;
}

.tile {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(18, 22, 34, 0.9);
  border: 2px solid rgba(90, 110, 150, 0.7);
  box-shadow: inset 0 0 0 1px rgba(5, 8, 15, 0.8);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tile.flash-explore {
  animation: tileExploreFlash 0.35s ease-out;
}

.tile.flash-stele {
  animation: tileSteleFlash 0.4s ease-out;
}

@keyframes tileExploreFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(140, 200, 255, 0.8);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 16px 4px rgba(140, 200, 255, 0.9);
    transform: scale(1.03);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(140, 200, 255, 0);
    transform: scale(1);
  }
}

@keyframes tileSteleFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 120, 160, 0.8);
    transform: scale(1);
  }
  20% {
    transform: scale(1.03) rotate(1deg);
  }
  40% {
    transform: scale(0.98) rotate(-1deg);
  }
  60% {
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 120, 160, 0);
    transform: scale(1);
  }
}

.tile-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  font-size: 24px;
  text-align: center;
}

.tile-cost-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  padding: 1px 5px;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.4;
  background: rgba(140, 80, 140, 0.9);
  color: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.tile.revealed {
  background: radial-gradient(circle at 30% 30%, #2a3548, #1a1f2e);
}

.tile.previewed:not(.revealed) {
  border-style: dashed;
  border-color: rgba(180, 200, 255, 0.9);
}

/* 揭示后按类型区分 */
.tile.tile-empty,
.tile.tile-tale {
  background: linear-gradient(135deg, #1e2535, #161b22);
  border-color: rgba(100, 110, 130, 0.6);
}

.tile.tile-stele {
  background: linear-gradient(135deg, #2a1f35, #1a1520);
  border-color: rgba(140, 80, 120, 0.7);
  box-shadow: inset 0 0 20px rgba(100, 50, 80, 0.2);
}

/* 藏有钟楼钥匙的石碑（已预览或已揭示时可见） */
.tile.tile-stele.tile-stele-has-key {
  box-shadow:
    inset 0 0 20px rgba(100, 50, 80, 0.2),
    0 0 0 1px rgba(255, 200, 120, 0.35),
    0 0 12px rgba(255, 190, 90, 0.2);
}

.tile-stele-key-badge {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 17.6px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff8e8;
  background: linear-gradient(
    145deg,
    rgba(200, 155, 70, 0.98),
    rgba(130, 95, 35, 0.95)
  );
  border: 1px solid rgba(255, 230, 160, 0.65);
  box-shadow:
    0 0 10px rgba(255, 200, 100, 0.45),
    0 2px 4px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  animation: steleKeyBadgeGlow 2.2s ease-in-out infinite;
}

@keyframes steleKeyBadgeGlow {
  0%,
  100% {
    box-shadow:
      0 0 8px rgba(255, 200, 100, 0.35),
      0 2px 4px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      0 0 14px rgba(255, 215, 130, 0.55),
      0 2px 4px rgba(0, 0, 0, 0.35);
  }
}

.tile.tile-bank {
  background: linear-gradient(135deg, #2a3020, #1a2018);
  border-color: rgba(160, 140, 60, 0.7);
}

.tile.tile-hospital {
  background: linear-gradient(135deg, #1e2a2a, #141e1e);
  border-color: rgba(80, 160, 140, 0.6);
}

.tile.tile-ruin {
  background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
  border-color: rgba(80, 80, 80, 0.6);
}

.tile.tile-food {
  background: linear-gradient(135deg, #2a2518, #1a1810);
  border-color: rgba(180, 140, 80, 0.6);
}

.tile.tile-relic {
  background: linear-gradient(135deg, #2a1f28, #1a1518);
  border-color: rgba(160, 120, 100, 0.6);
}

.tile.tile-shop {
  background: linear-gradient(135deg, #3a3020, #20160a);
  border-color: rgba(210, 170, 90, 0.85);
  box-shadow: 0 0 10px rgba(220, 190, 110, 0.35);
}

.tile.tile-alchemy {
  background: linear-gradient(135deg, #1f2a28, #151a18);
  border-color: rgba(80, 160, 140, 0.5);
}

.tile.tile-clock {
  background: linear-gradient(135deg, #2a2820, #1a1810);
  border-color: rgba(220, 180, 80, 0.8);
  box-shadow: 0 0 12px rgba(220, 180, 80, 0.3);
}

.tile.tile-tower {
  background: linear-gradient(135deg, #252a2a, #151a1a);
  border-color: rgba(120, 150, 150, 0.6);
}

.tile.tile-start {
  background: linear-gradient(135deg, #1e2a35, #141a22);
  border-color: rgba(100, 200, 255, 0.7);
}

.tile.start {
  border-color: #54d6ff;
}

.tile.clock {
  border-color: #ffd25f;
}

.tile.clock-available {
  animation: clockAvailablePulse 1s ease-in-out infinite;
}

@keyframes clockAvailablePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 210, 95, 0.0);
    transform: translateZ(0);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(255, 210, 95, 0.25);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 210, 95, 0.0);
  }
}

.tile.locked-clock::after {
  content: "锁";
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
}

.tile-blocked {
  cursor: not-allowed;
}

.tile-blocked-adjacent {
  opacity: 0.35;
}

.tile-blocked-stele {
  opacity: 0.5;
}

.tile-blocked-stele::after {
  content: "✕";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid rgba(220, 120, 120, 0.8);
  color: rgba(255, 200, 200, 0.9);
  font-size: 38.4px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.tile-label {
  font-weight: 600;
  margin-bottom: 2px;
}

.tile-type {
  font-size: 16px;
  opacity: 0.8;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 160, 220, 0.4) rgba(0, 0, 0, 0.2);
  align-items: stretch;
}

/* 食物 / 旧物 / 日志 三块同宽（占满该列） */
.side-panel > .panel-block {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  align-self: stretch;
}

.side-panel > .panel-log.log-block {
  flex: 1 1 0;
  min-height: 0;
}

.side-panel-title {
  margin: 0;
  padding: 0 2px 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #a8d4f0;
  flex-shrink: 0;
}

.panel-block {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  border-left-width: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.panel-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.panel-status {
  background: linear-gradient(135deg, rgba(25, 35, 50, 0.98), rgba(15, 22, 35, 0.98));
  border-left-color: #5b9bd5;
  border-color: rgba(80, 130, 180, 0.35);
}

.panel-global {
  background: linear-gradient(135deg, rgba(22, 30, 46, 0.98), rgba(12, 18, 30, 0.98));
  border-left-color: #7aa4ff;
  border-color: rgba(110, 160, 220, 0.35);
}

.status-global {
  font-size: 12px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-global .status-line {
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(40, 60, 100, 0.35);
}

.panel-food {
  background: linear-gradient(135deg, rgba(30, 45, 40, 0.98), rgba(18, 28, 24, 0.98));
  border-left-color: #6bb88a;
  border-color: rgba(80, 140, 100, 0.35);
  overflow: visible;
}

.panel-food .inventory-list {
  /* 食物随数量自然增高，把空间让给日志区，避免食物区内出现滚动条 */
  max-height: none;
  overflow: visible;
  padding-right: 0;
  margin-right: 0;
}

.panel-food .inventory-list::-webkit-scrollbar {
  width: 8px;
}

.panel-food .inventory-list::-webkit-scrollbar-thumb {
  background: rgba(107, 184, 138, 0.4);
  border-radius: 4px;
}

.panel-food .inventory-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.panel-relic {
  background: linear-gradient(135deg, rgba(45, 38, 55, 0.98), rgba(28, 22, 38, 0.98));
  border-left-color: #b89b6b;
  border-color: rgba(160, 130, 90, 0.35);
  /* 内层 #relicInventory 自行滚动，此处勿裁切滚动条 */
  overflow: visible;
}

/* 旧物过多时侧栏内滚动，避免撑出视口、点不到下方日志/按钮 */
.panel-relic .inventory-list {
  max-height: min(20dvh, 220px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 155, 107, 0.55) rgba(0, 0, 0, 0.2);
  padding-right: 4px;
  margin-right: -2px;
}

.panel-relic .inventory-list::-webkit-scrollbar {
  width: 8px;
}

.panel-relic .inventory-list::-webkit-scrollbar-thumb {
  background: rgba(184, 155, 107, 0.45);
  border-radius: 4px;
}

.panel-relic .inventory-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.panel-log {
  background: linear-gradient(135deg, rgba(35, 35, 50, 0.98), rgba(22, 22, 35, 0.98));
  border-left-color: #8b7bb8;
  border-color: rgba(120, 100, 160, 0.35);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-log .panel-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  justify-content: flex-start;
}

.panel-log .panel-title .btn-export-log:first-of-type {
  margin-left: auto;
}

.btn-export-log {
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid rgba(180, 200, 210, 0.6);
  background: rgba(20, 40, 55, 0.9);
  color: #e5f1ff;
  cursor: pointer;
}

.btn-export-log:hover {
  background: rgba(40, 70, 90, 0.95);
}

.panel-block h2 {
  color: #e8f0f8;
}

.status-text {
  font-size: 11px;
  line-height: 1.45;
  color: #d4e2ff;
  min-height: 28px;
}

.inventory-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.inventory-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(22, 27, 40, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 0;
}

.inventory-item.flash {
  animation: inventoryFlash 0.45s ease-out;
}

@keyframes inventoryFlash {
  0% {
    background: rgba(90, 140, 230, 0.85);
  }
  100% {
    background: rgba(22, 27, 40, 0.85);
  }
}

.inventory-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.inventory-name {
  font-weight: 600;
}

/* 食物：名称 + 次数单行不换行，过长省略（与数量同一行） */
.panel-food .inventory-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 使用次数：与食物栏绿调、条目圆角同一套语言，半透明嵌在文案里，不抢眼 */
.inventory-uses {
  display: inline-block;
  padding: 1px 5px;
  margin-left: 1px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.35;
  vertical-align: 0.06em;
  color: #e8faf3;
  background: rgba(32, 52, 44, 0.4);
  border: 1px solid rgba(107, 184, 138, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 1px 1px rgba(0, 0, 0, 0.12);
}

.inventory-meta {
  font-size: 11px;
  opacity: 0.8;
}

.inventory-buttons {
  display: flex;
  gap: 4px;
}

.inventory-buttons .btn-discard {
  color: #a0a0a0;
  border-color: rgba(255, 255, 255, 0.15);
}

.inventory-buttons .btn-discard:hover {
  color: #c0c0c0;
}

.log-block {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 1;
}

.log {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  font-size: 11px;
  line-height: 1.5;
  font-family:
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  color: rgba(200, 210, 228, 0.9);
}

.log-entry {
  padding: 4px 6px 4px 8px;
  margin: 2px 0;
  border-bottom: 1px dotted rgba(100, 130, 170, 0.22);
  border-left: 3px solid rgba(120, 150, 190, 0.35);
  border-radius: 0 4px 4px 0;
  background: rgba(12, 18, 28, 0.25);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry span.tag {
  display: inline-block;
  padding: 2px 6px;
  margin-right: 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(80, 120, 200, 0.55);
  color: rgba(248, 250, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  min-width: 36px;
  text-align: center;
  vertical-align: top;
}

/* 正文与 Day 前缀：前缀统一低调灰，正文按分类高对比着色 */
.log-entry .log-msg {
  letter-spacing: 0.02em;
  vertical-align: top;
}

.log-entry .log-day {
  display: inline;
  color: rgba(120, 135, 158, 0.78);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-right: 4px;
}

.log-entry .log-body {
  display: inline;
  font-size: 11px;
  font-weight: 600;
  color: #c4d0e8;
}

/* ——— 分类：标签徽标 + 左侧色条 + 正文色 ——— */

.log-entry.tag-石碑 {
  border-left-color: #e04558;
  background: linear-gradient(90deg, rgba(90, 22, 32, 0.5) 0%, rgba(20, 14, 20, 0.2) 100%);
  border-bottom-color: rgba(140, 40, 55, 0.35);
}

.log-entry.tag-石碑 span.tag {
  background: linear-gradient(165deg, rgba(110, 22, 38, 0.95) 0%, rgba(60, 8, 18, 0.92) 100%);
  border-color: rgba(220, 80, 90, 0.35);
  color: #ffc9c9;
  box-shadow:
    0 0 12px rgba(180, 30, 50, 0.35),
    inset 0 1px 0 rgba(255, 120, 120, 0.12);
}

.log-entry.tag-石碑 .log-body {
  color: #ff8a95;
  text-shadow:
    0 0 12px rgba(200, 40, 60, 0.55),
    0 0 1px rgba(60, 10, 20, 0.9);
}

.log-entry.tag-探索 {
  border-left-color: #4ec8f0;
  background: linear-gradient(90deg, rgba(25, 55, 85, 0.45) 0%, rgba(14, 20, 32, 0.18) 100%);
}

.log-entry.tag-探索 span.tag {
  background: linear-gradient(165deg, rgba(45, 85, 120, 0.9) 0%, rgba(20, 45, 72, 0.92) 100%);
  border-color: rgba(120, 190, 230, 0.28);
  color: #c8e8ff;
  box-shadow: 0 0 10px rgba(60, 140, 200, 0.22);
}

.log-entry.tag-探索 .log-body {
  color: #6ee0ff;
  text-shadow: 0 0 8px rgba(60, 180, 230, 0.35);
}

.log-entry.tag-食物 {
  border-left-color: #7fd968;
  background: linear-gradient(90deg, rgba(35, 70, 40, 0.42) 0%, rgba(14, 22, 18, 0.15) 100%);
}

.log-entry.tag-食物 span.tag {
  background: linear-gradient(165deg, rgba(70, 130, 55, 0.88) 0%, rgba(35, 75, 40, 0.9) 100%);
  border-color: rgba(160, 220, 120, 0.25);
  color: #e4f5d4;
}

.log-entry.tag-食物 .log-body {
  color: #b8f090;
  text-shadow: 0 0 6px rgba(100, 200, 80, 0.22);
}

.log-entry.tag-旧物 {
  border-left-color: #e8a855;
  background: linear-gradient(90deg, rgba(75, 52, 28, 0.42) 0%, rgba(18, 16, 14, 0.15) 100%);
}

.log-entry.tag-旧物 span.tag {
  background: linear-gradient(165deg, rgba(150, 110, 55, 0.9) 0%, rgba(85, 55, 28, 0.88) 100%);
  border-color: rgba(230, 190, 120, 0.3);
  color: #f5e0c0;
}

.log-entry.tag-旧物 .log-body {
  color: #ffd49a;
  text-shadow: 0 0 6px rgba(230, 160, 80, 0.2);
}

.log-entry.tag-银行 {
  border-left-color: #ffcc55;
  background: linear-gradient(90deg, rgba(85, 65, 25, 0.4) 0%, rgba(18, 16, 12, 0.14) 100%);
}

.log-entry.tag-银行 span.tag {
  background: linear-gradient(165deg, rgba(175, 145, 55, 0.92) 0%, rgba(95, 72, 25, 0.9) 100%);
  border-color: rgba(255, 220, 120, 0.35);
  color: #fff6d0;
}

.log-entry.tag-银行 .log-body {
  color: #ffe066;
  text-shadow: 0 0 8px rgba(255, 200, 80, 0.25);
}

.log-entry.tag-疗养院 {
  border-left-color: #5fe8b8;
  background: linear-gradient(90deg, rgba(28, 85, 65, 0.4) 0%, rgba(12, 22, 20, 0.14) 100%);
}

.log-entry.tag-疗养院 span.tag {
  background: linear-gradient(165deg, rgba(55, 145, 115, 0.9) 0%, rgba(25, 75, 60, 0.9) 100%);
  border-color: rgba(120, 220, 180, 0.3);
  color: #d8fff0;
}

.log-entry.tag-疗养院 .log-body {
  color: #7fffd4;
  text-shadow: 0 0 6px rgba(80, 220, 170, 0.22);
}

.log-entry.tag-日程 {
  border-left-color: #b894ff;
  background: linear-gradient(90deg, rgba(55, 38, 95, 0.4) 0%, rgba(16, 14, 24, 0.14) 100%);
}

.log-entry.tag-日程 span.tag {
  background: linear-gradient(165deg, rgba(120, 90, 175, 0.88) 0%, rgba(55, 35, 95, 0.9) 100%);
  border-color: rgba(190, 160, 255, 0.28);
  color: #e8deff;
}

.log-entry.tag-日程 .log-body {
  color: #d4b8ff;
  text-shadow: 0 0 8px rgba(160, 120, 255, 0.2);
}

.log-entry.tag-结局 {
  border-left-color: #ff4466;
  background: linear-gradient(90deg, rgba(70, 18, 28, 0.55) 0%, rgba(20, 10, 14, 0.25) 100%);
}

.log-entry.tag-结局 span.tag {
  background: linear-gradient(165deg, rgba(95, 25, 35, 0.95) 0%, rgba(35, 8, 14, 0.96) 100%);
  border-color: rgba(255, 90, 90, 0.4);
  color: #ffb0b0;
  box-shadow: 0 0 14px rgba(160, 30, 45, 0.45);
}

.log-entry.tag-结局 .log-body {
  color: #ff8899;
  text-shadow: 0 0 10px rgba(200, 50, 80, 0.45);
}

.log-entry.tag-钥匙 {
  border-left-color: #f0c060;
  background: linear-gradient(90deg, rgba(75, 58, 28, 0.4) 0%, rgba(18, 16, 12, 0.14) 100%);
}

.log-entry.tag-钥匙 span.tag {
  background: linear-gradient(165deg, rgba(185, 145, 65, 0.92) 0%, rgba(95, 70, 30, 0.9) 100%);
  border-color: rgba(255, 210, 130, 0.4);
  color: #fff8e0;
}

.log-entry.tag-钥匙 .log-body {
  color: #ffd080;
  text-shadow: 0 0 6px rgba(255, 190, 100, 0.2);
}

.log-entry.tag-胜利 {
  border-left-color: #58f0a8;
  background: linear-gradient(90deg, rgba(28, 85, 65, 0.48) 0%, rgba(12, 24, 22, 0.2) 100%);
}

.log-entry.tag-胜利 span.tag {
  background: linear-gradient(165deg, rgba(55, 120, 95, 0.9) 0%, rgba(25, 65, 55, 0.92) 100%);
  border-color: rgba(140, 255, 200, 0.35);
  color: #d8ffe8;
  box-shadow: 0 0 12px rgba(80, 200, 150, 0.25);
}

.log-entry.tag-胜利 .log-body {
  color: #98ffd0;
  text-shadow: 0 0 10px rgba(100, 240, 180, 0.3);
}

.log-entry.tag-故事 {
  border-left-color: #c8a8e8;
  background: linear-gradient(90deg, rgba(55, 42, 75, 0.38) 0%, rgba(16, 14, 22, 0.12) 100%);
}

.log-entry.tag-故事 span.tag {
  background: linear-gradient(165deg, rgba(95, 75, 120, 0.85) 0%, rgba(40, 30, 58, 0.88) 100%);
  border-color: rgba(200, 180, 230, 0.22);
  color: #ede4ff;
}

.log-entry.tag-故事 .log-body {
  color: #e8d8ff;
  font-style: italic;
  font-weight: 500;
  text-shadow: 0 0 6px rgba(180, 150, 230, 0.15);
}

.log-entry.tag-系统 {
  border-left-color: #8899b8;
  background: linear-gradient(90deg, rgba(38, 48, 65, 0.35) 0%, rgba(12, 16, 22, 0.1) 100%);
}

.log-entry.tag-系统 span.tag {
  background: rgba(55, 70, 95, 0.75);
  border-color: rgba(140, 160, 190, 0.22);
  color: #c8d2e4;
}

.log-entry.tag-系统 .log-body {
  color: #aabdd8;
  font-weight: 500;
}

.log-entry.tag-商店 {
  border-left-color: #d080ff;
  background: linear-gradient(90deg, rgba(65, 42, 95, 0.42) 0%, rgba(16, 12, 22, 0.14) 100%);
}

.log-entry.tag-商店 span.tag {
  background: linear-gradient(165deg, rgba(130, 95, 160, 0.88) 0%, rgba(60, 40, 85, 0.9) 100%);
  border-color: rgba(210, 170, 255, 0.28);
  color: #f0e0ff;
}

.log-entry.tag-商店 .log-body {
  color: #e8b8ff;
  text-shadow: 0 0 8px rgba(200, 120, 255, 0.2);
}

.log-entry.tag-炼金 {
  border-left-color: #b868ff;
  background: linear-gradient(90deg, rgba(55, 32, 95, 0.45) 0%, rgba(14, 12, 22, 0.15) 100%);
}

.log-entry.tag-炼金 span.tag {
  background: linear-gradient(165deg, rgba(90, 55, 140, 0.9) 0%, rgba(40, 22, 72, 0.92) 100%);
  border-color: rgba(180, 120, 255, 0.32);
  color: #e8d4ff;
  box-shadow: 0 0 10px rgba(120, 60, 200, 0.2);
}

.log-entry.tag-炼金 .log-body {
  color: #d8a8ff;
  text-shadow: 0 0 8px rgba(160, 100, 255, 0.22);
}

.log-entry.tag-哨塔 {
  border-left-color: #ff9a55;
  background: linear-gradient(90deg, rgba(55, 52, 48, 0.42) 0%, rgba(14, 14, 16, 0.14) 100%);
}

.log-entry.tag-哨塔 span.tag {
  background: linear-gradient(165deg, rgba(75, 85, 100, 0.9) 0%, rgba(35, 42, 55, 0.92) 100%);
  border-color: rgba(255, 160, 80, 0.35);
  color: #ffe8d0;
}

.log-entry.tag-哨塔 .log-body {
  color: #ffc090;
  text-shadow: 0 0 6px rgba(255, 150, 90, 0.18);
}

/* 首日玩法介绍：迷雾覆层 */
.mist-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  box-sizing: border-box;
}

.mist-intro-overlay.hidden {
  display: none;
}

.mist-intro-fog {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 80% at 50% 100%, rgba(35, 55, 45, 0.92) 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 20% 30%, rgba(60, 40, 70, 0.35) 0%, transparent 50%),
    radial-gradient(ellipse 80% 50% at 80% 20%, rgba(40, 55, 75, 0.4) 0%, transparent 45%),
    linear-gradient(180deg, rgba(8, 12, 18, 0.55) 0%, rgba(4, 8, 14, 0.92) 100%);
  animation: mistIntroFogDrift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes mistIntroFogDrift {
  0% {
    filter: blur(0) saturate(1);
    transform: scale(1) translate(0, 0);
    opacity: 1;
  }
  100% {
    filter: blur(1px) saturate(1.15);
    transform: scale(1.03) translate(-0.8%, 0.5%);
    opacity: 0.92;
  }
}

.mist-intro-vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}

.mist-intro-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  max-height: min(85vh, 560px);
  overflow-y: auto;
  padding: 22px 24px 20px;
  border-radius: 14px;
  background: linear-gradient(
    165deg,
    rgba(18, 26, 32, 0.94) 0%,
    rgba(12, 18, 24, 0.97) 50%,
    rgba(16, 22, 28, 0.95) 100%
  );
  border: 1px solid rgba(90, 130, 110, 0.45);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 12px 40px rgba(0, 0, 0, 0.65),
    0 0 60px rgba(40, 80, 70, 0.15);
  color: #c8d4cc;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 140, 120, 0.4) rgba(0, 0, 0, 0.2);
}

.mist-intro-epigraph {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: 0.06em;
  color: rgba(160, 185, 170, 0.75);
  font-style: italic;
  text-align: center;
}

.mist-intro-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-align: center;
  color: #9ecab8;
  text-shadow: 0 0 24px rgba(80, 140, 110, 0.35);
}

.mist-intro-body {
  font-size: 13px;
  line-height: 1.72;
  letter-spacing: 0.02em;
}

.mist-intro-body p {
  margin: 0 0 12px;
  text-indent: 0;
  color: rgba(210, 220, 212, 0.88);
}

.mist-intro-body p:last-of-type {
  margin-bottom: 18px;
}

.mist-intro-dismiss {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 11px 16px;
  font-size: 14px;
  letter-spacing: 0.2em;
  border-radius: 8px;
  border: 1px solid rgba(110, 160, 130, 0.55);
  background: linear-gradient(180deg, rgba(45, 75, 62, 0.9), rgba(28, 48, 40, 0.95));
  color: #e8f2ec;
  cursor: pointer;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.mist-intro-dismiss:hover {
  background: linear-gradient(180deg, rgba(55, 90, 75, 0.95), rgba(32, 55, 46, 0.98));
  box-shadow: 0 0 20px rgba(80, 140, 100, 0.25);
}

.mist-intro-dismiss:focus-visible {
  outline: 2px solid rgba(140, 200, 160, 0.7);
  outline-offset: 2px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(420px, 90vw);
  max-height: 80vh;
  min-height: 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: #0d111a;
  border: 1px solid rgba(130, 190, 255, 0.7);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.modal-content h2 {
  margin: 0;
  font-size: 15px;
}

.game-over-content {
  text-align: center;
  border-color: rgba(180, 80, 80, 0.8);
  overflow-y: auto;
}

.game-win-content {
  text-align: center;
  border-color: rgba(70, 180, 120, 0.8);
  overflow-y: auto;
}

.game-over-content h2 {
  font-size: 18px;
  color: #e8a0a0;
}

.game-over-content p {
  margin: 12px 0;
  font-size: 14px;
  color: #d4d4d4;
}

.game-over-summary-extra {
  margin: 4px 0 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #d8dde8;
  text-align: left;
  max-height: min(42vh, 260px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.game-over-summary-extra ul {
  margin: 4px 0 0 18px;
  padding: 0;
}

.game-over-summary-extra li {
  margin: 2px 0;
}

.game-over-actions,
.game-win-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-top: 6px;
}

.game-over-actions button,
.game-win-actions button {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-game-over-export {
  border-color: rgba(180, 200, 210, 0.6);
  background: rgba(32, 48, 68, 0.95);
}

.modal-body {
  flex: 1;
  min-height: 0;
  max-height: min(58vh, 520px);
  font-size: 13px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(130, 180, 255, 0.45) rgba(0, 0, 0, 0.25);
  padding-right: 4px;
  margin-right: -2px;
}

/* 选项弹窗由内层 .modal-choice-scroll 负责滚动，避免双滚动条 */
.modal-body.modal-body-choice-mode {
  overflow-y: hidden;
}

.modal-resource-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  margin: 0 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(130, 190, 255, 0.35);
  background: linear-gradient(135deg, rgba(28, 40, 62, 0.82), rgba(18, 26, 42, 0.9));
  color: #d8e8ff;
  font-size: 12px;
  line-height: 1.35;
}

.modal-resource-item {
  white-space: nowrap;
}

.modal-resource-item b {
  color: #ffd88a;
  font-weight: 700;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(130, 180, 255, 0.4);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.modal-actions {
  display: flex;
  flex-shrink: 0;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* showChoiceModal：旧物/食物选项过多时在此区域内滚动，避免点不到底部项 */
.modal-choice-scroll {
  max-height: min(62vh, 520px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(130, 180, 255, 0.45) rgba(0, 0, 0, 0.25);
  padding-right: 4px;
  margin-right: -2px;
}

.modal-choice-scroll::-webkit-scrollbar {
  width: 8px;
}

.modal-choice-scroll::-webkit-scrollbar-thumb {
  background: rgba(130, 180, 255, 0.4);
  border-radius: 4px;
}

.modal-choice-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.choice-item {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(110, 150, 210, 0.7);
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}

.choice-item:hover {
  background: rgba(60, 90, 150, 0.4);
  transform: translateY(-1px);
}

.choice-item-insufficient .choice-name {
  color: #ff8080;
  font-weight: 700;
}

.choice-item-insufficient .choice-name .inventory-uses {
  color: inherit;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-left: 0;
  font-weight: 700;
  font-size: inherit;
  vertical-align: baseline;
}

.choice-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.choice-meta {
  font-size: 12px;
  opacity: 0.8;
  white-space: pre-line;
}

.shop-gold-hint {
  margin-bottom: 8px;
  font-size: 12px;
  color: #ffb070;
}

.hidden {
  display: none;
}

.badge {
  display: inline-block;
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 4px;
  font-size: 10px;
  background: rgba(120, 180, 255, 0.75);
}

@media (max-width: 900px) {
  .main-layout {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    gap: 10px;
  }

  .hud-panel {
    flex: 0 1 auto;
    max-height: min(38dvh, 320px);
    overflow-y: auto;
  }

  .hud-panel-tail {
    flex: 0 1 auto;
    max-height: min(10rem, 28dvh);
  }

  .grid-section {
    flex: 0 0 auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .side-panel {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(110, 160, 220, 0.4) rgba(0, 0, 0, 0.2);
  }

  .grid-column {
    width: min(96vw, 92vw, 560px);
  }

  .grid-column--center {
    width: min(96vw, 92vw, 560px);
    margin-inline: auto;
    height: auto;
  }

  .grid-wrapper--play {
    flex: 0 1 auto;
    max-height: none;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .grid {
    width: min(80dvh, 100%, 92vw);
    max-width: 100%;
    max-height: min(80dvh, 100%);
    gap: 10px;
  }

  .tile-inner {
    padding: 10px;
    font-size: 22.4px;
  }

  .log-block {
    flex: 0 1 auto;
    max-height: min(40dvh, 360px);
  }

  .modal-body {
    max-height: min(52vh, 440px);
  }

  .modal-choice-scroll {
    max-height: min(48vh, 380px);
  }
}

