/* ===== 时空坐标 · 移动端横屏模式 ===== */

/* ── 横屏切换按钮 ── */
.landscape-toggle {
  display: none;
  position: fixed;
  bottom: 1.2rem;
  right: 1rem;
  z-index: 9999;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #c0392b, #8b1a1a);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 6px 22px rgba(159, 45, 32, 0.4);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.landscape-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(159, 45, 32, 0.5);
}

.landscape-toggle:active {
  transform: scale(0.95);
}

@media (max-width: 900px) {
  .landscape-toggle { display: flex; }
}

/* ── 横屏模式激活 ── */
html.landscape-mode,
html.landscape-mode body {
  overflow: hidden !important;
  height: 100% !important;
  width: 100% !important;
}

html.landscape-mode body {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: var(--bg, #f6edda) !important;
}

html.landscape-mode body::before {
  display: none !important;
}

html.landscape-mode .nav,
html.landscape-mode .page-banner,
html.landscape-mode .hero,
html.landscape-mode .mode-switch,
html.landscape-mode .toolbar,
html.landscape-mode .scroll-actions,
html.landscape-mode footer,
html.landscape-mode .rotate-hint {
  display: none !important;
}

html.landscape-mode main {
  position: fixed !important;
  top: 0 !important;
  left: 100% !important;
  margin: 0 !important;
  padding: 0.8rem !important;
  width: 100vh !important;
  height: 100vw !important;
  transform: rotate(90deg) !important;
  transform-origin: top left !important;
  overflow: hidden !important;
  background: var(--bg, #f6edda) !important;
  z-index: 9998 !important;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

html.landscape-mode .landscape-toggle {
  bottom: auto !important;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 10000;
  background: rgba(0,0,0,0.65);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

html.landscape-mode .landscape-toggle .ls-icon {
  transform: rotate(-90deg);
}

/* ── 横屏下的时间轴微调 ── */
html.landscape-mode .timeline-shell {
  position: relative !important;
  padding: 20px 8px 16px !important;
  border-radius: 20px !important;
}

html.landscape-mode .timeline-track {
  height: 180px !important;
  padding: 0 12px !important;
}

html.landscape-mode .practice-mode .timeline-track {
  height: 400px !important;
}

html.landscape-mode .timeline-item {
  width: 130px !important;
  margin: 0 12px !important;
}

html.landscape-mode .side-scroll {
  width: 30px !important;
  height: 40px !important;
  font-size: 1.6rem !important;
}

/* ── 横屏模式下弹窗：不旋转，全屏竖屏显示 ── */
html.landscape-mode .modal-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  transform: none !important;
  z-index: 10002 !important;
  opacity: 1 !important;
  visibility: visible !important;
  background-color: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(8px) !important;
  padding: 16px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

html.landscape-mode .modal-backdrop[aria-hidden="true"] {
  display: none !important;
}

html.landscape-mode .modal-backdrop .modal-card {
  width: 94vw !important;
  max-height: 90vh !important;
  transform: none !important;
  padding: 26px 22px 20px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  border-radius: 28px !important;
}

html.landscape-mode .modal-backdrop.show .modal-card {
  transform: none !important;
}

/* 关闭按钮：放大并确保可见 */
html.landscape-mode .modal-close {
  top: 10px !important;
  right: 14px !important;
  font-size: 2.4rem !important;
  width: 44px !important;
  height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(255, 248, 234, 0.9) !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  z-index: 10 !important;
}

html.landscape-mode .modal-close:active {
  transform: scale(0.9) !important;
}

/* ── 横屏下的滑动提示 ── */
html.landscape-mode .swipe-hint {
  position: fixed !important;
  bottom: 8px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 10001 !important;
  background: rgba(0,0,0,0.55) !important;
  color: #fff !important;
  padding: 4px 14px !important;
  border-radius: 999px !important;
  font-size: 0.78rem !important;
  margin: 0 !important;
  pointer-events: none !important;
}

/* ── 横屏下弹窗内滑动关闭 ── */
html.landscape-mode .modal-backdrop.show {
  touch-action: pan-y !important;
}

/* ===== 移动端触摸滑动时间轴 ===== */
@media (max-width: 900px) {
  .timeline-shell {
    touch-action: pan-x;
    -webkit-user-select: none;
    user-select: none;
    cursor: grab;
  }
  .timeline-shell:active { cursor: grabbing; }
  .timeline-scroll {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }
  .timeline-scroll::-webkit-scrollbar { height: 4px; }
  .swipe-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.82rem;
    animation: swipeHintPulse 2.5s ease-in-out infinite;
    pointer-events: none;
  }
  @keyframes swipeHintPulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
  }
  .swipe-hint-arrow {
    display: inline-block;
    animation: swipeArrow 1.5s ease-in-out infinite;
  }
  @keyframes swipeArrow {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(6px); }
  }
}