/* ==========================================================================
   BUDA OPUS 0 · STAGE 7: EMR (设备主权与离网漫游协议协同)
   100% 独立解耦架构 · 继承第五幕 148px 工控终端与 7:5 大画幅 · 纯增量样式
   ========================================================================== */

#stage7-viewport {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 100;
    background: transparent;
    opacity: 1;
    container-type: size;
    transition: opacity 2.0s cubic-bezier(0.16, 1, 0.3, 1);
}

#stage7-viewport.active {
    display: block !important;
}

#stage7-viewport.fading-out {
    opacity: 0 !important;
    pointer-events: none;
}

/* 随点随停全局冻结支持 */
body.engine-paused *,
body.engine-paused *::before,
body.engine-paused *::after,
#app-frame.engine-paused * {
    animation-play-state: paused !important;
}

/* ==========================================================================
   [台阶 1：哲学锚点] 全站基准 (24px / 500 / -0.01em)
   ========================================================================== */
#s7-anchor-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 120;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#s7-anchor-layer.visible {
    opacity: 1;
}

#s7-anchor-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 24px;
    font-weight: 500;
    color: #141418;
    letter-spacing: -0.01em;
    text-align: center;
    line-height: 1.4;
}

/* ==========================================================================
   [核心舞台：双雄竞技场 最大化自适应排版]
   距上方分割线约 10px，距下方导轨约 10px，自适应全部分辨率
   ========================================================================== */
#s7-arena-layout {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
    width: 100%;
    max-width: 1560px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    box-sizing: border-box;
    padding: 0 16px;
    z-index: 110;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: opacity, transform;
    transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#s7-arena-layout.fading-out {
    opacity: 0 !important;
}

/* 左右工位容器：采用第五幕高度反推宽度公式 */
.s7-station {
    width: min(calc(48cqw - 45px), calc((100cqh - 176px) * 1.4));
    max-width: 680px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-sizing: border-box;
    transition: transform 1.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.2s ease;
}

/* 右工位 (章鱼) 登场 */
.s7-station-right {
    transform: translateY(32px);
    opacity: 0;
}

.s7-station-right.entered {
    transform: translateY(0);
    opacity: 1;
}

.s7-station-left {
    opacity: 1;
}

/* ==========================================================================
   两端 7:5 画幅卡片 (自适应饱满大画幅)
   ========================================================================== */
.s7-card-box {
    width: 100%;
    aspect-ratio: 7 / 5;
    position: relative;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
    background: transparent;
    box-sizing: border-box;
}

/* 左侧底盘大卡片：全视窗物理左边缘外进出场 */
#s7-card-node {
    transition: transform 0.95s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.85s ease;
    will-change: transform, opacity;
}

#s7-card-node.slid-out {
    transform: translate3d(calc(-50vw - 60%), 0, 0) !important;
    opacity: 0 !important;
}

#s7-card-node.slid-in {
    transform: translate3d(0, 0, 0) !important;
    opacity: 1 !important;
}

#s7-chassis-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    pointer-events: none;
}

.s7-octo-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #141418;
}

#s7-console-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    pointer-events: none;
}

/* NODE B 物理遮罩层 (精确锁定原图 90.9% / 6.6%) */
.s7-node-b-mask {
    position: absolute;
    left: 90.9%;
    top: 6.6%;
    width: 6.3%;
    height: 6.0%;
    background: #262626;
    border-radius: 2px;
    pointer-events: none;
    z-index: 15;
    transition: opacity 0.35s ease;
    opacity: 0; /* 第七幕初始已在网，常亮 */
}

/* 阶段一核心：NODE B 纯代码灰阶遮挡呼吸 (透明-遮挡-透明-遮挡...) */
.s7-node-b-mask.mask-breathing {
    animation: s7NodeBBreathing 2.2s infinite ease-in-out !important;
}

@keyframes s7NodeBBreathing {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.95; }
}

/* 阶段三核心：永久深灰彻底遮盖覆写 (清空槽位，无红框) */
.s7-node-b-mask.mask-permanent-covered {
    opacity: 1 !important;
    transition: opacity 0.5s ease;
}

/* NODE B 脉冲同心光环 (复验成功时迸发) */
.s7-node-b-ping {
    position: absolute;
    left: 94.1%;
    top: 8.7%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    pointer-events: none;
    z-index: 20;
    display: none;
}

.s7-node-b-ping.active {
    display: block;
}

.s7-ping-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid #00AEEF;
    opacity: 0;
}

.s7-node-b-ping.active .r1 { animation: s7NodeBPing 1.8s 0.0s cubic-bezier(0.2, 0.8, 0.3, 1) 3 forwards; }
.s7-node-b-ping.active .r2 { animation: s7NodeBPing 1.8s 0.2s cubic-bezier(0.2, 0.8, 0.3, 1) 3 forwards; }
.s7-node-b-ping.active .r3 { animation: s7NodeBPing 1.8s 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) 3 forwards; }

@keyframes s7NodeBPing {
    0% { transform: scale(0.6); opacity: 1; border-color: #FFFFFF; }
    50% { opacity: 0.95; border-color: #00AEEF; }
    100% { transform: scale(4.4); opacity: 0; border-color: #00AEEF; }
}

/* [局部磨砂层] 位于控制台视口内底层图片上方 (z-index: 50) */
#s7-blur-overlay {
    position: absolute;
    inset: 0;
    background: rgba(244, 244, 240, 0.38);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    will-change: opacity;
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.35, 1);
}

#s7-blur-overlay.active {
    opacity: 1;
}

/* ==========================================================================
   顶置独立工控通信 HUD：148px 高度 / 13px 字号 / 21px 滚动步长 (100% 对齐第五幕)
   ========================================================================== */
.s7-terminal-box {
    width: 100%;
    height: 148px;
    background: rgba(244, 244, 240, 0.98);
    border: 1px solid rgba(20, 20, 24, 0.18);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border-radius: 3px;
    padding: 8px 14px;
    margin-bottom: 10px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
    display: flex;
    flex-direction: column;
}

.s7-terminal-box.visible {
    opacity: 1;
}

.s7-terminal-box.blink-1 {
    animation: s7TerminalSuccessBlink 0.95s ease-in-out 1 !important;
}

.s7-terminal-box.blink-3 {
    animation: s7TerminalSuccessBlink 0.95s ease-in-out 3 !important;
}

@keyframes s7TerminalSuccessBlink {
    0%, 100% {
        border-color: rgba(20, 20, 24, 0.18);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
        background: rgba(244, 244, 240, 0.98);
    }
    50% {
        border-color: #00AEEF;
        box-shadow: 0 0 24px rgba(0, 174, 239, 0.5), inset 0 0 12px rgba(0, 174, 239, 0.12);
        background: #FFFFFF;
    }
}

.s7-term-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(20, 20, 24, 0.1);
    padding-bottom: 4px;
    margin-bottom: 5px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.s7-term-title { color: #141418; }
.s7-term-title.octo { color: #00AEEF; }

.s7-term-badge {
    font-size: 9.5px;
    padding: 2px 7px;
    border: 1px solid rgba(20, 20, 24, 0.25);
    color: #141418;
    letter-spacing: 0.05em;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.s7-term-badge.bound {
    border-color: #00AEEF;
    color: #00AEEF;
    background: rgba(0, 174, 239, 0.08);
    font-weight: 700;
}

.s7-term-screen {
    height: 105px;
    overflow: hidden;
    position: relative;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 13px;
    line-height: 21px;
    text-align: left;
    box-sizing: border-box;
}

.s7-screen-stream {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transform: translateY(0);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.s7-screen-row {
    color: #141418;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 21px;
    line-height: 21px;
    font-weight: 500;
}

/* ==========================================================================
   中央水平雷达声纳走廊 (精准 76px 间隙与定向动画)
   ========================================================================== */
.s7-radio-corridor {
    width: 76px;
    align-self: flex-start;
    margin-top: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.s7-radio-corridor.active {
    opacity: 1;
}

.s7-sonar-svg {
    width: 76px;
    height: 48px;
    overflow: visible;
}

.s7-pulse-arc {
    fill: none;
    stroke: #141418;
    stroke-width: 2.2px;
    stroke-linecap: round;
    opacity: 0;
}

.s7-carrier-dot {
    fill: #141418;
    opacity: 0;
}

/* 向右定向发射脉冲 (Siren -> Octo) */
.s7-corridor-firing-right .arc-r1 { animation: s7SonarPingRight 0.8s 0.0s cubic-bezier(0.2, 0.8, 0.3, 1) infinite; }
.s7-corridor-firing-right .arc-r2 { animation: s7SonarPingRight 0.8s 0.14s cubic-bezier(0.2, 0.8, 0.3, 1) infinite; }
.s7-corridor-firing-right .arc-r3 { animation: s7SonarPingRight 0.8s 0.28s cubic-bezier(0.2, 0.8, 0.3, 1) infinite; }
.s7-corridor-firing-right .dot-r { animation: s7CarrierFlyRight 0.8s cubic-bezier(0.2, 0.8, 0.3, 1) infinite; }

@keyframes s7SonarPingRight {
    0% { opacity: 0; transform: translateX(-12px); }
    30% { opacity: 0.95; }
    100% { opacity: 0; transform: translateX(24px); }
}

@keyframes s7CarrierFlyRight {
    0% { opacity: 0; transform: translateX(0); }
    30% { opacity: 1; }
    100% { opacity: 0; transform: translateX(52px); }
}

/* 向左定向发射脉冲 (Octo -> Siren) */
.s7-corridor-firing-left .arc-l1 { animation: s7SonarPingLeft 0.8s 0.0s cubic-bezier(0.2, 0.8, 0.3, 1) infinite; }
.s7-corridor-firing-left .arc-l2 { animation: s7SonarPingLeft 0.8s 0.14s cubic-bezier(0.2, 0.8, 0.3, 1) infinite; }
.s7-corridor-firing-left .arc-l3 { animation: s7SonarPingLeft 0.8s 0.28s cubic-bezier(0.2, 0.8, 0.3, 1) infinite; }
.s7-corridor-firing-left .dot-l { animation: s7CarrierFlyLeft 0.8s cubic-bezier(0.2, 0.8, 0.3, 1) infinite; }

@keyframes s7SonarPingLeft {
    0% { opacity: 0; transform: translateX(12px); }
    30% { opacity: 0.95; }
    100% { opacity: 0; transform: translateX(-24px); }
}

@keyframes s7CarrierFlyLeft {
    0% { opacity: 0; transform: translateX(0); }
    30% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-52px); }
}

/* ==========================================================================
   [核心状态陈述模块] 7:5 几何双居中 + 双行排布 + 3.5px 极简竖条
   ========================================================================== */
.s7-status-statement {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.25, 1, 0.35, 1);
}

.s7-status-statement.show {
    opacity: 1;
}

.s7-status-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border-left: 3.5px solid #00AEEF;
    padding-left: 18px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* 右工位：置于磨砂层上方 (z-index: 60)，纯白矢量字体绝对锐利 */
#s7-octo-center-text {
    z-index: 60;
}

#s7-octo-center-text .s7-status-box {
    color: #FFFFFF !important;
    border-left-color: #00AEEF;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

/* 左工位：底盘滑出后留白区呈现，炭黑字体 (#141418) */
#s7-node-center-text {
    z-index: 10;
    top: auto;
    bottom: 0;
    height: auto;
    aspect-ratio: 7 / 5;
}

#s7-node-center-text .s7-status-box {
    color: #141418;
    border-left-color: #00AEEF;
}