/* ==========================================================================
   《残明狂刀》全局复位、舞台容器、乌木鎏金纹饰与通用组件原语
   ========================================================================== */

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-abyss);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

img {
  display: block;
  max-width: 100%;
  -webkit-user-drag: none;
  user-select: none;
}

/* 舞台根容器 */
.app-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #151018 0%, #07060a 100%);
}

.game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-canvas);
  touch-action: none;
  display: block;
}

.ui-ember-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-embers);
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.ui-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* 允许局部长面板纵向顺滑滚动（适配移动端横竖屏） */
.scroll-y {
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.4) rgba(0, 0, 0, 0.25);
}

.scroll-y::-webkit-scrollbar {
  width: 5px;
}

.scroll-y::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.28);
}

.scroll-y::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.42);
  border-radius: 3px;
}

/* 鎏金雕花边框面板 */
.gilded-panel {
  position: relative;
  background: rgba(12, 10, 15, 0.94);
  border: 1px solid var(--border-gold-subtle);
  box-shadow: var(--shadow-card);
}

.gilded-panel::before,
.gilded-panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--gold-400);
  border-style: solid;
  pointer-events: none;
  opacity: 0.85;
}

.gilded-panel::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.gilded-panel::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

/* 乌木鎏金猩红刀纹按钮 */
.btn-blade {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 26px;
  background: var(--grad-ebony-btn);
  border: 1px solid rgba(212, 175, 55, 0.48);
  color: var(--text-ivory);
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), inset 0 0 18px rgba(212, 175, 55, 0.08);
  transition: transform 0.18s var(--ease-out-expo), border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  overflow: hidden;
}

.btn-blade::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 25%, rgba(245, 212, 122, 0.26) 50%, transparent 75%);
  transform: translateX(-120%);
  transition: transform 0.55s var(--ease-out-expo);
  pointer-events: none;
}

.btn-blade:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  border-color: var(--gold-300);
  color: var(--gold-100);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.35);
}

.btn-blade:hover:not(:disabled)::before {
  transform: translateX(120%);
}

.btn-blade:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

/* 主战猩红刀纹按钮变体 */
.btn-blade-primary {
  background: linear-gradient(135deg, #520909 0%, #9e1616 48%, #470808 100%);
  border: 1px solid rgba(245, 212, 122, 0.78);
  box-shadow: 0 10px 30px rgba(153, 27, 27, 0.52), inset 0 1px 0 rgba(255, 232, 175, 0.35);
  color: #fff8ea;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

.btn-blade-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6e0d0d 0%, #c81e1e 50%, #610a0a 100%);
  box-shadow: 0 12px 36px rgba(220, 38, 38, 0.65), 0 0 24px rgba(245, 212, 122, 0.42);
}

/* 朱砂鎏金帅印大按钮（披甲出征 / 拔刀入阵） */
.btn-imperial-seal {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 36px;
  background: linear-gradient(160deg, #b91c1c 0%, #dc2626 42%, #7f1d1d 100%);
  border: 2px solid var(--gold-300);
  border-radius: 4px;
  color: #fff9eb;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.82);
  box-shadow:
    0 10px 32px rgba(185, 28, 28, 0.62),
    0 0 0 3px rgba(127, 29, 29, 0.45),
    inset 0 0 16px rgba(255, 235, 175, 0.28);
  transition: transform 0.18s var(--ease-out-expo), box-shadow 0.22s ease, filter 0.2s ease;
  animation: sealAuraPulse 2.8s ease-in-out infinite;
}

.btn-imperial-seal:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.1);
  box-shadow:
    0 14px 40px rgba(220, 38, 38, 0.82),
    0 0 28px rgba(245, 212, 122, 0.55),
    inset 0 0 20px rgba(255, 240, 190, 0.42);
}

.btn-imperial-seal:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

/* 篆刻红印章小徽标 */
.cinnabar-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  background: rgba(185, 28, 28, 0.9);
  border: 1.5px solid #fca5a5;
  border-radius: 2px;
  color: #fff5f5;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 10px rgba(185, 28, 28, 0.55);
  transform: rotate(-4deg);
}

/* 键鼠快捷键角标 */
.kbd-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  background: rgba(10, 9, 14, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.52);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--gold-200);
  font-family: var(--font-num);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
}

/* 词条数值与关键词高亮 */
.hl-num {
  color: var(--gold-200);
  font-family: var(--font-num);
  font-weight: 700;
}

.hl-kw {
  color: #fca5a5;
  font-weight: 600;
}

/* 悬浮详情提示框 */
.tooltip-floating {
  position: fixed;
  z-index: var(--z-tooltip);
  max-width: 300px;
  padding: 12px 15px;
  background: rgba(10, 8, 13, 0.96);
  border: 1px solid var(--gold-400);
  border-radius: 4px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.9), 0 0 18px rgba(212, 175, 55, 0.25);
  pointer-events: none;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.tooltip-floating .tt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.22);
}

.tooltip-floating .tt-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.tooltip-floating .tt-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold-200);
}

.tooltip-floating .tt-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.tooltip-floating .tt-desc {
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 通用关键帧动效 */
@keyframes kenBurnsBreath {
  0% {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  50% {
    transform: scale(1.085) translate3d(-1.2%, -0.8%, 0);
  }
  100% {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
}

@keyframes sealAuraPulse {
  0%, 100% {
    box-shadow:
      0 10px 30px rgba(185, 28, 28, 0.55),
      0 0 0 3px rgba(127, 29, 29, 0.4),
      inset 0 0 14px rgba(255, 235, 175, 0.24);
  }
  50% {
    box-shadow:
      0 12px 38px rgba(239, 68, 68, 0.8),
      0 0 22px rgba(245, 212, 122, 0.45),
      inset 0 0 22px rgba(255, 240, 190, 0.38);
  }
}

@keyframes bladeTitleShine {
  0%, 72%, 100% {
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.92)) drop-shadow(0 0 18px rgba(220, 38, 38, 0.35));
  }
  84% {
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.92)) drop-shadow(0 0 32px rgba(245, 212, 122, 0.72));
  }
}

@keyframes rageFlamePulse {
  0%, 100% {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.65), 0 0 24px rgba(220, 38, 38, 0.45);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 0 22px rgba(253, 224, 71, 0.95), 0 0 36px rgba(239, 68, 68, 0.8);
    filter: brightness(1.18);
  }
}

@keyframes comboHitPop {
  0% {
    transform: scale(1.36) rotate(-3deg);
  }
  60% {
    transform: scale(0.96) rotate(0deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hornPulseRight {
  0%, 100% {
    transform: translateX(0);
    opacity: 0.92;
  }
  50% {
    transform: translateX(8px);
    opacity: 1;
  }
}

@keyframes lowHpDanger {
  0%, 100% {
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.45);
  }
  50% {
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.95);
  }
}
