/* ==========================================================================
   《物理 OL：火种重燃》全局多端自适应引擎样式表 (css/core-responsive.css)
   四档响应式容器布局：
   1. 桌面宽屏 (> 1100px)
   2. 平板端 (768px ~ 1100px)
   3. 手机竖屏 (<= 767px, portrait)：上舞台 55% + 下抽屉式双切控制台 45%
   4. 手机横屏 (<= 932px, landscape 掌机模式)：42px 超薄顶栏 + 左舞台 62% + 右控制台 38%
   ========================================================================== */

/* 宽屏紧凑过渡档 (1101px ~ 1560px)：确保 1440×900 下顶栏 6 个关卡胶囊与任务横幅 100% 完整展示不截断 */
@media screen and (max-width: 1560px) and (min-width: 1101px) {
    .brand-emblem,
    .brand-sub {
        display: none;
    }

    .brand-title {
        font-size: 14.5px;
    }

    .stage-node {
        padding: 4px 7px;
        font-size: 11px;
        gap: 3px;
    }

    .pipe-link {
        width: 4px;
    }

    .top-actions .action-btn {
        padding: 4px 8px;
        font-size: 11.5px;
    }

    .mission-tag {
        display: none;
    }
}

/* ==========================================================================
   档位 2：平板端 (768px ~ 1100px)
   ========================================================================== */
@media screen and (max-width: 1100px) {
    .top-nav {
        height: 54px;
        padding: 0 10px;
        gap: 6px;
    }

    .brand-emblem,
    .brand-sub {
        display: none;
    }

    .brand-title {
        font-size: 13.5px;
    }

    .stage-pipeline {
        gap: 4px;
    }

    .stage-node {
        padding: 4px 7px;
        font-size: 11px;
        gap: 4px;
        border-radius: 8px;
    }

    .stage-node .idx {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .pipe-link {
        display: none;
    }

    .top-actions {
        gap: 5px;
    }

    .action-btn {
        padding: 4px 7px;
        font-size: 11px;
        border-radius: 8px;
    }

    /* 右侧操控台收窄至 330px，禁止横向滚动条 */
    .tactical-sidebar {
        width: 330px;
        padding: 7px 9px;
        overflow-x: hidden;
    }

    .mentor-portrait-box {
        width: 68px;
    }

    .mentor-portrait-box img {
        width: 64px;
        height: 70px;
    }

    .mentor-name-tag {
        font-size: 9px;
    }

    .pc-chip {
        padding: 3px 2px;
        font-size: 9.5px;
    }

    /* 任务横幅：在平板端将实时手指路标独立成完整一行，杜绝被挤压省略 */
    .mission-banner {
        flex-wrap: wrap;
        padding: 5px 10px;
        gap: 5px;
    }

    .mission-badge {
        display: none;
    }

    #mission-craft-badge {
        font-size: 10.5px !important;
        padding: 2px 7px !important;
    }

    .forge-blueprint-strip {
        padding: 5px 8px;
    }

    .forge-part-chip {
        font-size: 10px;
        padding: 2px 5px;
    }

    .forge-explore-bar {
        padding: 4px 6px;
        gap: 4px;
    }

    .forge-step-pill {
        font-size: 9.5px;
        padding: 2px 5px;
    }

    #btn-toggle-spoiler {
        padding: 2px 6px !important;
        font-size: 10px !important;
    }

    .mission-tag {
        font-size: 12.5px;
    }

    .mission-right-group {
        margin-left: auto;
    }

    .step-pointer-pill {
        order: 3;
        flex: 0 0 100%;
        max-width: 100%;
        font-size: 12px;
        padding: 4px 10px;
    }

    .wave-pill {
        padding: 3px 8px;
        font-size: 11px;
    }

    /* Stage 2 平板端紧凑化 */
    #view-stage2 {
        padding: 10px 14px;
        gap: 10px;
    }

    .mag-card {
        width: 158px;
        height: 158px;
    }

    .pendulum-box {
        min-height: 140px;
    }

    /* 22章目录在平板端改为双列 */
    .curr-vol-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   档位 3：手机竖屏 (<= 767px, portrait)
   - 顶栏折叠为单行紧凑顶栏 + 可横向滑动的关卡胶囊条
   - 主工作区切换为「上实验主舞台 54% + 下抽屉式紧凑控制台 46%」
   - 控制台启用「🛠️ 实验操控 / 👨‍🏫 林老师步骤清单」一键切换页签
   ========================================================================== */
@media screen and (max-width: 767px) and (orientation: portrait) {
    .top-nav {
        height: auto;
        flex-wrap: wrap;
        padding: 4px 7px;
        gap: 3px;
    }

    .brand-group {
        gap: 5px;
    }

    .brand-emblem {
        width: 22px;
        height: 22px;
        font-size: 12px;
        border-radius: 6px;
    }

    .brand-title {
        font-size: 12px;
    }

    .brand-sub {
        display: none;
    }

    .top-actions {
        gap: 2px;
        width: 100%;
        justify-content: space-between;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .top-actions::-webkit-scrollbar {
        display: none;
    }

    .action-btn {
        padding: 2px 4px;
        font-size: 9.5px;
        border-radius: 6px;
    }

    .stage-pipeline {
        order: 3;
        width: 100%;
        padding-bottom: 1px;
        gap: 4px;
    }

    .stage-node {
        padding: 3px 7px;
        font-size: 10.5px;
        border-radius: 7px;
    }

    .stage-node .idx {
        width: 16px;
        height: 16px;
        font-size: 9.5px;
    }

    .pipe-link {
        display: none;
    }

    /* 主工作区上下分屏：上舞台 54% + 下抽屉控制台 46% */
    .main-workspace {
        flex-direction: column;
    }

    .stage-viewport-area {
        flex: 0 0 54%;
        height: 54%;
        width: 100%;
        padding: 4px 6px;
        gap: 4px;
    }

    .mission-banner {
        min-height: 26px;
        flex-wrap: nowrap;
        padding: 3px 6px;
        gap: 4px;
        border-radius: 9px;
    }

    .mission-tag,
    .mission-badge,
    #mission-craft-badge {
        display: none !important;
    }

    .forge-blueprint-strip {
        padding: 4px 7px;
    }

    .forge-part-chip {
        font-size: 9.5px;
        padding: 2px 5px;
    }

    .mission-right-group {
        margin-left: 0;
        gap: 2px;
    }

    .wave-pills {
        gap: 2px;
    }

    .wave-pill {
        padding: 2px 5px;
        font-size: 9px;
        border-radius: 5px;
    }

    .wave-pill.locked {
        display: none;
    }

    #btn-reopen-briefing,
    #btn-reroll-wave {
        padding: 2px 5px !important;
        font-size: 9px !important;
    }

    .step-pointer-pill {
        order: 1;
        flex: 1;
        min-width: 0;
        font-size: 10px;
        padding: 2px 6px;
        text-align: left;
    }

    .viewport-host {
        border-radius: 12px;
    }

    /* 下方抽屉式紧凑控制台（占 46%） */
    .tactical-sidebar {
        flex: 0 0 46%;
        height: 46%;
        width: 100%;
        border-left: none;
        border-top: 2.5px solid var(--ink);
        padding: 4px 7px;
        gap: 3px;
        overflow-x: hidden;
    }

    /* 启用双切页签，合流「🛠️ 实验操控」与「👨‍🏫 林老师步骤清单」 */
    .mobile-console-tabs {
        display: grid;
        gap: 4px;
    }

    .mobile-console-tab {
        padding: 3px 6px;
        font-size: 11px;
        border-radius: 7px;
    }

    .tactical-sidebar[data-mobile-tab="controls"] .mentor-guide-card,
    .tactical-sidebar[data-mobile-tab="controls"] .forge-blueprint-strip {
        display: none;
    }

    .tactical-sidebar[data-mobile-tab="mentor"] #sidebar-dynamic {
        display: none;
    }

    /* 手机竖屏下抽屉内部卡片与按钮紧凑化，确保一屏展示完整仪表与操控按钮 */
    #sidebar-dynamic {
        gap: 4px;
    }

    .tac-card {
        padding: 4px 7px;
        border-radius: 10px;
    }

    .tac-card-title {
        font-size: 10.5px;
        margin-bottom: 2px;
        padding-bottom: 2px;
    }

    .oled-grid {
        gap: 3px;
    }

    .oled-box {
        padding: 2px 5px;
        border-radius: 6px;
    }

    .oled-lbl {
        font-size: 9px;
        margin-bottom: 0;
    }

    .oled-val {
        font-size: 11.5px;
    }

    .tac-btn {
        padding: 4px 8px;
        font-size: 11.5px;
        border-radius: 8px;
    }

    .tac-btn-row {
        gap: 4px;
        margin-bottom: 4px !important;
    }

    .precision-control {
        margin-bottom: 3px !important;
    }

    .pc-head {
        font-size: 10.5px;
        margin-bottom: 2px;
    }

    .pc-pill {
        font-size: 10.5px;
        padding: 0 5px;
    }

    .pc-step-btn {
        height: 22px;
        min-width: 22px;
        font-size: 10.5px;
    }

    .pc-chips {
        margin-top: 2px;
        gap: 3px;
    }

    .pc-chip {
        padding: 2px 3px;
        font-size: 9.5px;
    }

    /* Stage 2 在手机竖屏上半屏内紧凑排布 */
    #view-stage2 {
        padding: 6px 8px;
        gap: 8px;
    }

    .mech-wrap {
        height: min(94%, 250px);
    }

    .mech-hit.crown {
        width: 38%;
        height: 10%;
        left: 31%;
        top: 1%;
        font-size: 9.5px;
    }

    .mech-hit.side {
        width: 22%;
        height: 9%;
        left: 6%;
        top: 14%;
        font-size: 9.5px;
    }

    .sw-right-column {
        gap: 6px;
    }

    .mag-card {
        width: 104px;
        height: 104px;
        border-width: 2.5px;
    }

    .mag-badge {
        font-size: 8.5px;
        padding: 1px 6px;
        bottom: -6px;
    }

    .pendulum-box {
        min-height: 88px;
        max-height: 124px;
        border-radius: 10px;
    }

    /* Stage 3 顶部悬浮条紧凑化 */
    .s3-overlay-bar {
        top: 6px;
        left: 6px;
        right: 6px;
        gap: 4px;
    }

    .s3-chip {
        padding: 3px 8px;
        font-size: 10px;
    }

    /* Stage 4 双赛道+双图像在手机竖屏上半屏紧凑排布 */
    #view-stage4 {
        padding: 5px 7px;
        gap: 5px;
    }

    .s4-track-card {
        height: 86px;
        padding: 4px 8px;
        border-radius: 10px;
    }

    .s4-track-header {
        font-size: 9.5px;
    }

    .s4-track-header span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .s4-lanes {
        margin: 2px 0;
    }

    .s4-car-unit {
        width: 52px;
        height: 19px;
    }

    .s4-car-unit.ghost-car {
        top: 3px;
    }

    .s4-car-unit.player-car {
        bottom: 3px;
    }

    .s4-charts-row {
        gap: 5px;
    }

    .s4-chart-card {
        padding: 4px 6px;
        border-radius: 10px;
    }

    .s4-chart-title {
        font-size: 9.5px;
        margin-bottom: 2px;
    }

    .s4-chart-title span:first-child {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .s4-chart-title span:last-child {
        display: none;
    }

    /* 舞台过关反馈浮层在手机竖屏适配 */
    .stage-feedback-overlay {
        padding: 4px 6px;
    }

    .feedback-card {
        width: 98%;
        padding: 6px 9px;
        gap: 8px;
        border-radius: 11px;
    }

    .feedback-npc-img {
        width: 48px;
        height: 58px;
    }

    .feedback-title {
        font-size: 12.5px;
        margin-bottom: 2px;
    }

    .feedback-desc {
        font-size: 10.5px;
        margin-bottom: 5px;
        line-height: 1.32;
    }

    /* 弹窗在手机竖屏适配 */
    .prologue-stage-canvas {
        height: 200px;
    }

    .prologue-dialog-area {
        padding: 10px 12px;
        gap: 10px;
    }

    .prologue-npc-avatar {
        width: 62px;
        height: 74px;
    }

    .prologue-slide-title {
        font-size: 14.5px;
    }

    .prologue-slide-text {
        font-size: 12px;
    }

    .prologue-footer {
        flex-direction: column;
        align-items: stretch;
        padding: 8px 12px;
        gap: 8px;
    }

    .prologue-steps {
        justify-content: center;
        gap: 4px;
    }

    .prologue-step-dot {
        padding: 3px 8px;
        font-size: 10.5px;
    }

    .prologue-nav-btns {
        justify-content: space-between;
    }

    .cutscene-box {
        padding: 14px;
    }

    .hangar-cutscene-box {
        padding: 0 !important;
        max-height: 95vh;
    }

    .hangar-top-bar {
        padding: 6px 10px;
    }

    .hangar-machine-name {
        display: none;
    }

    .hangar-canvas-wrap {
        height: 112px;
    }

    .hangar-bottom-grid {
        grid-template-columns: 1fr;
        padding: 8px 10px;
        gap: 8px;
        text-align: left;
    }

    .qc-options-grid {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .hangar-footer-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 7px 10px;
        gap: 6px;
    }

    .hangar-footer-hint {
        white-space: normal;
        font-size: 10.5px;
    }

    #cutscene-next-btn {
        width: 100% !important;
    }

    .cutscene-cg-banner {
        height: 130px;
    }

    .cutscene-inner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .cutscene-npc {
        width: 96px;
        height: 112px;
    }

    .curr-vol-grid,
    .curr-vol-grid.single-vol .curr-chap-list {
        grid-template-columns: 1fr;
    }

    .mindmap-header {
        height: auto;
        padding: 8px 12px;
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   档位 4：手机横屏掌机模式 (<= 932px, landscape)
   - 顶栏压缩至 42px 超薄状态栏
   - 主工作区采用「左舞台 62% + 右操控台 38%」
   - 隐藏大尺寸装饰头像，把空间 100% 让给实验画布与滑块
   ========================================================================== */
@media screen and (max-width: 932px) and (orientation: landscape) and (max-height: 540px) {
    .top-nav {
        height: 42px;
        padding: 0 8px;
        gap: 5px;
    }

    .brand-emblem {
        width: 26px;
        height: 26px;
        font-size: 14px;
        border-radius: 6px;
    }

    .brand-title {
        font-size: 12.5px;
    }

    .brand-sub {
        display: none;
    }

    .stage-pipeline {
        gap: 3px;
    }

    .stage-node {
        padding: 3px 6px;
        font-size: 10.5px;
        gap: 3px;
        border-radius: 6px;
    }

    .stage-node .idx {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }

    .pipe-link {
        display: none;
    }

    .top-actions {
        gap: 4px;
    }

    .action-btn {
        padding: 2px 6px;
        font-size: 10.5px;
        border-radius: 6px;
    }

    /* 主工作区：左舞台 62% + 右操控台 38% */
    .main-workspace {
        flex-direction: row;
    }

    .stage-viewport-area {
        flex: 0 0 62%;
        width: 62%;
        height: 100%;
        padding: 4px 6px;
        gap: 4px;
    }

    .tactical-sidebar {
        flex: 0 0 38%;
        width: 38%;
        height: 100%;
        padding: 4px 6px;
        gap: 4px;
        overflow-x: hidden;
    }

    /* 启用双切页签并隐藏大尺寸装饰头像，把空间 100% 让给画布与滑块 */
    .mobile-console-tabs {
        display: grid;
        gap: 4px;
    }

    .mobile-console-tab {
        padding: 3px 6px;
        font-size: 10.5px;
        border-radius: 7px;
        white-space: nowrap;
    }

    .tactical-sidebar[data-mobile-tab="controls"] .mentor-guide-card,
    .tactical-sidebar[data-mobile-tab="controls"] .forge-blueprint-strip {
        display: none;
    }

    .tactical-sidebar[data-mobile-tab="mentor"] #sidebar-dynamic {
        display: none;
    }

    .mentor-portrait-box {
        display: none;
    }

    /* 横屏掌机模式下右侧操控台紧凑排版 */
    #sidebar-dynamic {
        gap: 4px;
    }

    .tac-card {
        padding: 4px 7px;
        border-radius: 10px;
    }

    .tac-card-title {
        font-size: 10.5px;
        margin-bottom: 2px;
        padding-bottom: 2px;
    }

    .oled-grid {
        gap: 4px;
    }

    .oled-box {
        padding: 2px 5px;
        border-radius: 6px;
    }

    .oled-lbl {
        font-size: 9px;
    }

    .oled-val {
        font-size: 11.5px;
    }

    .tac-btn {
        padding: 4px 7px;
        font-size: 11px;
        border-radius: 8px;
    }

    .tac-btn-row {
        gap: 4px;
        margin-bottom: 4px !important;
    }

    .precision-control {
        margin-bottom: 4px;
    }

    .pc-head {
        font-size: 10.5px;
        margin-bottom: 2px;
    }

    .pc-pill {
        font-size: 10.5px;
        padding: 0 5px;
    }

    .pc-step-btn {
        height: 22px;
        min-width: 22px;
        font-size: 10.5px;
    }

    .pc-chips {
        margin-top: 2px;
        gap: 3px;
    }

    .pc-chip {
        padding: 2px 3px;
        font-size: 9.5px;
    }

    /* 手机横屏下顶栏已高亮当前关卡名，隐藏重复的 .mission-tag，把空间 100% 让给实时手指路标 */
    .mission-banner {
        min-height: 26px;
        flex-wrap: nowrap;
        padding: 2px 6px;
        gap: 5px;
        border-radius: 8px;
    }

    .mission-tag,
    #mission-craft-badge {
        display: none !important;
    }

    .step-pointer-pill {
        order: 1;
        flex: 1;
        min-width: 0;
        font-size: 10.5px;
        padding: 2px 8px;
        text-align: left;
    }

    .wave-pill {
        padding: 2px 5px;
        font-size: 9.5px;
    }

    .wave-pill.locked {
        display: none;
    }

    #btn-reopen-briefing,
    #btn-reroll-wave {
        padding: 2px 5px !important;
        font-size: 9.5px !important;
    }

    /* Stage 2 横屏掌机模式 */
    #view-stage2 {
        padding: 6px 10px;
        gap: 8px;
    }

    .mech-wrap {
        height: min(94%, 260px);
    }

    .mag-card {
        width: 110px;
        height: 110px;
        border-width: 2.5px;
    }

    .mag-badge {
        font-size: 8.5px;
        padding: 1px 6px;
        bottom: -6px;
    }

    .pendulum-box {
        min-height: 92px;
        max-height: 132px;
    }

    /* Stage 3 横屏掌机模式 */
    .s3-overlay-bar {
        top: 5px;
        left: 6px;
        right: 6px;
    }

    .s3-chip {
        padding: 2px 7px;
        font-size: 10px;
    }

    /* Stage 4 横屏掌机模式 */
    #view-stage4 {
        padding: 5px 7px;
        gap: 5px;
    }

    .s4-track-card {
        height: 82px;
        padding: 4px 8px;
        border-radius: 10px;
    }

    .s4-track-header {
        font-size: 10px;
    }

    .s4-track-header span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .s4-lanes {
        margin: 2px 0;
    }

    .s4-car-unit {
        width: 54px;
        height: 19px;
    }

    .s4-car-unit.ghost-car {
        top: 3px;
    }

    .s4-car-unit.player-car {
        bottom: 3px;
    }

    .s4-charts-row {
        gap: 5px;
    }

    .s4-chart-card {
        padding: 4px 6px;
        border-radius: 10px;
    }

    .s4-chart-title {
        font-size: 9.5px;
        margin-bottom: 2px;
    }

    .s4-chart-title span:first-child {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .s4-chart-title span:last-child {
        display: none;
    }

    /* 弹窗在手机横屏适配 */
    .stage-feedback-overlay {
        padding: 4px 8px;
    }

    .feedback-card {
        width: 98%;
        padding: 6px 10px;
        gap: 8px;
        border-radius: 11px;
    }

    .feedback-npc-img {
        width: 46px;
        height: 56px;
    }

    .feedback-title {
        font-size: 12.5px;
        margin-bottom: 2px;
    }

    .feedback-desc {
        font-size: 10.5px;
        margin-bottom: 5px;
        line-height: 1.32;
    }

    .prologue-stage-canvas {
        height: 165px;
    }

    .prologue-header {
        padding: 6px 12px;
    }

    .prologue-dialog-area {
        padding: 6px 12px;
        gap: 10px;
    }

    .prologue-npc-avatar {
        width: 52px;
        height: 62px;
    }

    .prologue-slide-title {
        font-size: 14px;
    }

    .prologue-slide-text {
        font-size: 11.5px;
    }

    .prologue-footer {
        padding: 6px 12px;
    }

    .cutscene-cg-banner {
        height: 110px;
    }

    .cutscene-npc {
        width: 84px;
        height: 100px;
    }

    .hangar-cutscene-box {
        padding: 0 !important;
        max-height: 95vh;
    }

    .hangar-top-bar {
        padding: 5px 12px;
    }

    .hangar-canvas-wrap {
        height: 125px;
    }

    .hangar-bottom-grid {
        padding: 6px 12px;
        gap: 8px;
    }

    .hangar-footer-bar {
        padding: 5px 12px;
    }
}
