/* ==========================================================================
   《长征 · 现场》平台选课矩阵 · 跨课切换 · 移动端自适应与横屏引导
   ========================================================================== */

/* ---------- 渲染与镜头过渡丝滑加速（消除合成器毛玻璃回读与重排卡顿） ---------- */
.grain {
  display: none !important;
}
#labels {
  transition: opacity 0.28s ease;
  will-change: opacity;
}
#labels.is-hidden {
  opacity: 0;
  pointer-events: none !important;
}
#labels.is-hidden * {
  pointer-events: none !important;
}
.mk {
  contain: layout style;
  backface-visibility: hidden;
}
.mk-pin, .mk-pin img, .pin-medal {
  filter: none !important;
}
.mk-label {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(14, 12, 10, 0.93) !important;
}
.mk-main.st-frontier .mk-label {
  background: linear-gradient(135deg, rgba(120, 22, 14, 0.95), rgba(20, 12, 10, 0.95)) !important;
}
.mk-meeting .mk-label {
  background: rgba(11, 20, 28, 0.94) !important;
}

/* ---------- 平台选课大厅（首屏 3D 沙盘浮层） ---------- */
.intro.intro-portal {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(95deg, rgba(8, 10, 14, 0.92) 0%, rgba(8, 10, 14, 0.76) 52%, rgba(8, 10, 14, 0.28) 100%);
}

.intro-portal-inner {
  max-width: 980px;
  width: 100%;
}

.portal-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  font-size: 12.5px;
  letter-spacing: 2.2px;
  color: var(--gold-hi);
  opacity: 0.92;
}
.portal-section-line {
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold-hi), rgba(214, 163, 68, 0.2));
  flex-shrink: 0;
}

.course-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 4px;
}

.course-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  text-decoration: none;
  padding: 18px 18px 16px;
  border-radius: 10px;
  background: linear-gradient(165deg, rgba(24, 21, 18, 0.90) 0%, rgba(14, 13, 12, 0.88) 100%);
  border: 1px solid rgba(214, 163, 68, 0.24);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 240, 208, 0.06);
  backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.24s var(--ease-out), border-color 0.24s ease, box-shadow 0.24s ease, background 0.24s ease;
}

.course-card.is-featured {
  border-color: rgba(232, 69, 47, 0.55);
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(198, 42, 31, 0.22) 0%, transparent 62%),
    linear-gradient(165deg, rgba(28, 22, 19, 0.92) 0%, rgba(15, 13, 12, 0.90) 100%);
}

.course-card.is-live:hover {
  transform: translateY(-3px);
  border-color: var(--gold-hi);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.62), 0 0 24px rgba(214, 163, 68, 0.16);
}

.course-card.is-featured:hover {
  border-color: #ff6a52;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.65), 0 0 28px rgba(198, 42, 31, 0.28);
}

.course-card.is-building {
  border-style: dashed;
  border-color: rgba(214, 163, 68, 0.26);
  background: linear-gradient(165deg, rgba(20, 19, 17, 0.78) 0%, rgba(12, 12, 11, 0.78) 100%);
}
.course-card.is-building:hover {
  transform: translateY(-2px);
  border-color: rgba(214, 163, 68, 0.52);
}

.cc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 11px;
}

.cc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  white-space: nowrap;
}
.cc-badge.live {
  background: rgba(47, 158, 114, 0.16);
  border: 1px solid rgba(127, 224, 182, 0.34);
  color: #9bf0c9;
}
.course-card.is-featured .cc-badge.live {
  background: rgba(198, 42, 31, 0.24);
  border-color: rgba(242, 211, 139, 0.42);
  color: var(--gold-hi);
}
.cc-badge.building {
  background: rgba(214, 163, 68, 0.12);
  border: 1px solid rgba(214, 163, 68, 0.28);
  color: #dfc389;
}

.cc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.cc-code {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: rgba(201, 191, 173, 0.55);
}

.cc-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fbf2df;
  line-height: 1.3;
}

.cc-desc {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  flex: 1;
}

.cc-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 11px;
  border-top: 1px solid rgba(255, 236, 200, 0.10);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--gold-hi);
}
.course-card.is-featured .cc-cta {
  color: #ffd996;
}
.course-card.is-building .cc-cta {
  color: var(--muted);
  font-weight: 500;
}
.cc-arrow {
  transition: transform 0.2s ease;
}
.course-card:hover .cc-arrow {
  transform: translateX(4px);
}

/* ---------- 顶栏「切换课程」按钮与课程弹窗 ---------- */
.btn-switch-course {
  border-color: rgba(214, 163, 68, 0.42) !important;
  background: linear-gradient(180deg, rgba(42, 33, 20, 0.90), rgba(24, 19, 13, 0.92)) !important;
  color: var(--gold-hi) !important;
  gap: 6px;
}
.btn-switch-course:hover {
  border-color: var(--gold-hi) !important;
  background: linear-gradient(180deg, rgba(58, 45, 26, 0.95), rgba(32, 25, 16, 0.95)) !important;
}
.switch-ico {
  font-size: 14px;
  line-height: 1;
  color: var(--gold);
}
.lbl-switch {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.switch-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.switch-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 10px;
  background: rgba(255, 244, 220, 0.03);
  border: 1px solid rgba(255, 236, 200, 0.14);
  text-decoration: none;
  color: var(--text);
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.switch-item:hover {
  border-color: var(--gold);
  background: rgba(214, 163, 68, 0.08);
}
.switch-item.is-current {
  border-color: var(--red-hi);
  background: rgba(198, 42, 31, 0.12);
}
.switch-item h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  color: #fbf2df;
}
.switch-item p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
}
.switch-tag {
  font-size: 11.5px;
  letter-spacing: 1px;
  color: var(--gold-hi);
}
.switch-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.building-spec-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.building-spec-list li {
  padding: 12px 15px;
  border-radius: 8px;
  background: rgba(255, 244, 220, 0.035);
  border-left: 3px solid var(--gold);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-2);
}
.building-spec-list b {
  color: #fbf2df;
}

/* ---------- 手机竖屏：横屏观看引导浮层 ---------- */
.landscape-guide {
  display: none;
}

@keyframes tiltPhone {
  0%, 18% { transform: rotate(0deg); }
  55%, 82% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

@media (max-width: 900px) and (orientation: portrait) {
  .landscape-guide:not([hidden]) {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 14px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(18, 16, 14, 0.95);
    border: 1px solid rgba(214, 163, 68, 0.48);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(10px);
    color: var(--text);
  }
  .lg-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    color: var(--gold-hi);
  }
  .lg-icon svg {
    width: 26px;
    height: 26px;
    animation: tiltPhone 2.8s var(--ease-io) infinite;
  }
  .lg-copy {
    flex: 1;
    min-width: 0;
  }
  .lg-copy strong {
    display: block;
    font-size: 13.5px;
    color: #fbf2df;
    margin-bottom: 2px;
  }
  .lg-copy span {
    display: block;
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.4;
  }
  .lg-dismiss {
    flex-shrink: 0;
    padding: 7px 12px;
    border-radius: 7px;
    border: 1px solid rgba(214, 163, 68, 0.45);
    background: rgba(214, 163, 68, 0.14);
    color: var(--gold-hi);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }
}

/* ==========================================================================
   移动端与平板自适应布局（竖屏手机 & 横屏手机全覆盖）
   ========================================================================== */

@media (max-width: 960px) {
  .course-matrix {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .cc-code { display: none; }
  .intro {
    flex-direction: column !important;
    justify-content: flex-start !important;
    padding: 28px 20px 84px !important;
    align-items: stretch !important;
    overflow-y: auto !important;
  }
  .intro-foot {
    position: static !important;
    margin-top: 18px;
  }
  .ctrl-hint {
    display: none !important;
  }
  .drawer {
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    bottom: 72px !important;
    width: auto !important;
    max-width: none !important;
    max-height: 56dvh;
    overflow-y: auto;
  }
  .sheet {
    width: 96vw !important;
    height: 92dvh !important;
    max-width: 96vw !important;
    max-height: 92dvh !important;
  }
  .sheet-head {
    padding: 12px 14px 10px !important;
    flex-wrap: wrap;
    gap: 8px;
  }
  .sheet-tabs {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .sheet-tabs::-webkit-scrollbar { display: none; }
  .sheet-tabs button {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .sheet-body {
    padding: 14px !important;
  }
  .sheet-body.seg-type-interactive,
  .sheet-body.seg-type-scene3d {
    padding: 0 !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .dlg-dark, .dlg-paper {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90dvh !important;
  }
}

/* 竖屏窄手机（<= 640px，如微信内打开） */
@media (max-width: 640px) {
  .intro-kicker {
    font-size: 11px !important;
    letter-spacing: 1.5px !important;
  }
  .intro-kicker::before { width: 18px !important; }
  .intro-title {
    font-size: clamp(38px, 11vw, 54px) !important;
  }
  .intro-poem {
    font-size: 14px !important;
    gap: 12px !important;
    flex-wrap: wrap;
  }
  .portal-section-head {
    margin: 14px 0 10px;
    font-size: 11.5px;
    letter-spacing: 1px;
  }
  .course-card {
    padding: 14px 15px 13px;
  }
  .cc-title { font-size: 18px; }
  .cc-desc { font-size: 12.5px; margin-bottom: 11px; }

  .hud {
    padding: 8px 10px !important;
    gap: 6px;
  }
  .brand .seal {
    width: 32px !important;
    height: 32px !important;
    font-size: 10.5px !important;
  }
  .brand h1 {
    font-size: 16px !important;
  }
  .tally {
    display: none !important;
  }
  .hud-right {
    gap: 5px !important;
  }
  .hud-btn {
    padding: 6px 9px !important;
    height: 34px !important;
  }
  .lbl-switch {
    font-size: 12px;
  }
  .user-chip {
    padding: 4px 8px 4px 5px !important;
    height: 34px !important;
  }
  .user-chip #user-name {
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  .map-controls {
    top: 54px !important;
    left: 10px !important;
    gap: 6px !important;
    transform: scale(0.92);
    transform-origin: left top;
  }

  .trailbar {
    padding: 8px 10px 10px !important;
    gap: 10px !important;
  }
  .li-meter b { font-size: 18px !important; }
  .li-meter small.total { display: none !important; }
  .trail-track {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .trail-track::-webkit-scrollbar { display: none; }
  .trail-nodes {
    min-width: max-content;
    gap: 12px;
  }
  .btn-side-entry small { display: none !important; }
  .btn-side-entry { padding: 6px 10px !important; }

  .comic-placeholder {
    min-height: 0 !important;
  }
  .ct-stage {
    min-height: 340px !important;
  }
}

/* 手机横屏（高度 <= 540px，旋转手机后最佳浏览模式） */
@media (max-height: 540px) {
  .cc-code { display: none; }
  .intro {
    flex-direction: column !important;
    justify-content: flex-start !important;
    padding: 14px 24px 20px !important;
    align-items: stretch !important;
    overflow-y: auto !important;
  }
  .intro-title {
    font-size: clamp(34px, 6vw, 48px) !important;
    margin: 4px 0 !important;
  }
  .intro-poem {
    font-size: 13.5px !important;
    margin: 4px 0 8px !important;
  }
  .portal-section-head {
    margin: 8px 0;
  }
  .course-matrix {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px;
  }
  .course-card {
    padding: 11px 13px;
  }
  .cc-title { font-size: 16px; margin-bottom: 4px; }
  .cc-desc { font-size: 11.5px; line-height: 1.45; margin-bottom: 8px; }
  .cc-cta { padding-top: 7px; font-size: 12px; }
  .intro-foot {
    position: static !important;
    margin-top: 10px;
    font-size: 11px !important;
  }

  .hud {
    padding: 6px 14px !important;
  }
  .brand p { display: none !important; }
  .map-controls {
    top: 50px !important;
    left: 12px !important;
    transform: scale(0.88);
    transform-origin: left top;
  }
  .trailbar {
    padding: 6px 14px 8px !important;
  }
  .drawer {
    top: 52px !important;
    bottom: 56px !important;
    max-height: calc(100dvh - 108px) !important;
    overflow-y: auto !important;
    width: 320px !important;
    left: auto !important;
    right: 14px !important;
  }

  .sheet {
    width: 96vw !important;
    height: 94dvh !important;
    max-height: 94dvh !important;
  }
  .sheet-side {
    width: 62px !important;
    padding: 10px 6px !important;
  }
  .sheet-head {
    padding: 8px 14px 6px !important;
  }
  .sheet-kicker { display: none !important; }
  .sheet-title { font-size: 16px !important; }
  .sheet-body { padding: 10px 14px !important; }
  .sheet-body.seg-type-comic.has-teaser { padding: 6px 10px !important; }
  .comic-placeholder { min-height: 0 !important; }
}
