/* ==========================================================================
   CQ（彩蛋页）
   --------------------------------------------------------------------------
   世界观里这算一张"额外页面"，所以不必处处套站内那套控件语言：
   这里可以出现终端日志、可以折叠、可以有朴素链接。
   但底色与强调色仍沿用全站那套（深蓝黑 + 金色 + --ctl-* 令牌），别跳出这个站。
   ⚠️ --ctl-ease 是**时长**（0.25s），不是缓动函数 —— 写进 transition 简写里
      会变成"延迟"，要缓动就显式写 ease / ease-out。
   ========================================================================== */

.cq-section {
    /* 宽度写死 100% 再 max-width：body/main 是竖排 flex 容器，
       带 margin:auto 的 flex 项在交叉轴上不会被拉伸、会退化成 fit-content。
       高度交给 flex（flex:1 1 auto），不写死 100vh，否则页脚会被挤出视口。 */
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 120px 24px 80px;      /* 顶栏 72px + 呼吸 */
    flex: 1 1 auto;
}

/* 状态文字：就是两行字，不再是"标题 + 副标题" */
.cq-line {
    margin: 0 0 6px;
    font-size: 15px;
    line-height: 1.9;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.82);
}

/* 逐条出现：默认藏着，脚本按顺序加 .is-in（日志块那一步见页面的 runSteps） */
.cq-step {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}

.cq-step.is-in {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.45s ease, visibility 0s;
}

/* --------------------------------------------------------------------------
   准备过程的自检日志：跑完折叠起来（脚本加 .is-folded）
   -------------------------------------------------------------------------- */
.cq-boot {
    overflow: hidden;
    max-height: 380px;             /* 展开态的上限，够装下所有行 */
    margin: 18px 0 8px;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 215, 0, 0.28);
    transition: max-height 0.44s ease, opacity 0.3s ease, margin 0.44s ease,
                padding 0.44s ease;
}

.cq-boot.is-folded {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-left: 0;
}

/* ⚠️ 必须连后代一起写（`.cq-log *`）：global.css 顶部那条
   `* { font-family: "Sarasa" }` 给**每个元素**都直接指定了 Gothic，
   只写在容器上等于只改了容器自己的文字节点 —— 里面的 .cq-log__line
   还是 Gothic（而且这样等宽字面根本不会被下载）。与 `.markdown-body` 同一套写法。 */
.cq-log, .cq-log * {
    /* 终端读数用站的等宽字面 Sarasa Mono SC（@font-face 见 assets/css/global.css）；
       页面里给它加了一句 preload —— 字体策略是 font-display: block，取晚了这段会是空的 */
    font-family: "Sarasa Mono", "Sarasa", monospace;
    font-size: 12px;
    line-height: 1.85;
    color: rgba(255, 255, 255, 0.42);
}

.cq-log__line {
    white-space: pre-wrap;
    word-break: break-word;
}

.cq-log__tag {
    color: rgba(255, 255, 255, 0.28);
}

.cq-log__tag--ok {
    color: rgba(255, 215, 0, 0.75);          /* 金色在这站上就是"强调/通过" */
}

.cq-log__tag--warn {
    color: var(--ctl-err);
}

/* 打字光标：跟着最新一行走 */
.cq-log__caret {
    display: inline-block;
    width: 0.6em;
    height: 1em;
    margin-left: 2px;
    vertical-align: -0.15em;
    background: rgba(255, 215, 0, 0.8);
    animation: cq-caret 1.05s steps(1, end) infinite;
}

/* --------------------------------------------------------------------------
   「开始」：外观与一般正文**没有区别** —— 只有一条下划线，hover / 聚焦才变色。
   所以这里不用等宽、不加字距、不加内边距，字号与颜色都跟正文一致；
   下划线用 text-decoration（而不是 border-bottom），这样跟正文里的链接一样。
   -------------------------------------------------------------------------- */
.cq-actions {
    margin-top: 0;                /* 不留空行：紧跟上文，只差上一行自己的 6px 行距 */
    font-size: 15px;              /* 与 .cq-line 逐项对齐：字号、字距、行高、颜色 */
    letter-spacing: 1px;
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.82);
}

.cq-start {
    color: inherit;                                   /* 就是正文那支色 */
    text-decoration: underline;                       /* 唯一的外观区别 */
    text-decoration-color: rgba(255, 215, 0, 0.35);
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    cursor: pointer;
    transition: color 0.25s ease, text-decoration-color 0.25s ease;
}

.cq-start:hover,
.cq-start:focus-visible {
    color: #FFD700;                                   /* 另一个区别：hover / 聚焦变色 */
    text-decoration-color: currentColor;              /* 下划线跟着变金 */
}

.cq-start:focus-visible {
    outline: 2px solid rgba(255, 215, 0, 0.55);       /* 纯键盘可达性，平时看不见 */
    outline-offset: 4px;
}

/* 正在解析时（文案变"暂停"）：常驻金色 */
.cq-start[aria-pressed="true"] {
    color: #FFD700;
    text-decoration-color: currentColor;
}

/* 解析完成：文案定格，不再是可点的链接 */
.cq-start[aria-disabled="true"] {
    color: rgba(255, 255, 255, 0.45);
    text-decoration-color: rgba(255, 255, 255, 0.2);
    cursor: default;
    pointer-events: none;         /* 连 hover 变色也一并收掉 */
}

/* --------------------------------------------------------------------------
   解析控制台：按下「开始」才出现
   ⚠️ 可见性交给 hidden 属性，所以这里**不要**写 display（会盖掉 [hidden] 的 display:none）
   -------------------------------------------------------------------------- */
.cq-console {
    margin-top: 26px;
    padding: 16px 18px;
    background: rgba(8, 10, 24, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--ctl-panel-radius);
}

/* ⚠️ 同样要连后代一起写：见上面 .cq-log 那条注释（global.css 的 `*` 规则）。
   字号/行高也一起给，读数 / 点划 / 明文 / 行日志都对齐在同一套上
   （.cq-console__meta 是 11px，它自己的规则在后面，权重相同、会盖掉这里） */
.cq-console, .cq-console * {
    font-family: "Sarasa Mono", "Sarasa", monospace;
    font-size: 13px;
    line-height: 1.9;
}

.cq-console__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

/* 信号灯：跟加载屏里"这一步已完成"那个小金点同一套（小方块 + 金色 + 辉光） */
.cq-console__lamp {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.16);
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.cq-console__lamp.is-on {
    background: #FFD700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.85);
}

.cq-console__meta {
    font-size: 11px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.35);
}

/* 已收到的点划 */
.cq-console__code {
    min-height: 1.9em;
    letter-spacing: 4px;
    color: #FFD700;
    word-break: break-all;
}

/* 已解出的明文 */
.cq-console__text {
    margin-top: 2px;
    min-height: 1.9em;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.86);
    word-break: break-word;
}

/* 意料之外的退出（上次还在播就关了页面，位置没来得及记）：
   那一行改成错误文案，用站里的错误红 —— 与上面自检日志的 [ warn ] 同一个语义。
   字号/等宽都随控制台，只把字距收回来（默认 2–4px 的等宽字距排中文太散） */
.cq-console__code.is-error,
.cq-console__text.is-error {
    color: var(--ctl-err);
    letter-spacing: 1px;
}

/* 光标（块状）。正在发声时闪得快一些，像真的在收报 */
.cq-console__caret {
    display: inline-block;
    width: 0.55em;
    height: 1em;
    margin-left: 2px;
    vertical-align: -0.15em;
    background: rgba(255, 215, 0, 0.7);
    animation: cq-caret 1.05s steps(1, end) infinite;
}

.cq-console__caret.is-live {
    background: #FFD700;
    animation-duration: 0.45s;
}

@keyframes cq-caret {
    0%, 50%      { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .cq-sstv {
        animation: none;
    }

    .cq-log__caret,
    .cq-console__caret {
        animation: none;
    }

    .cq-boot {
        transition: none;
    }
}

/* 第二阶段（SSTV）整块：摩斯那段解析完之前 hidden —— 不用 opacity 藏，
   那样虽然看不见但仍占着高度，会在控制台下面留一大片空白。出现时淡入并上移一点。 */
.cq-sstv {
    margin-top: 34px;
    animation: cq-sstv-in 0.5s ease both;
}

.cq-sstv[hidden] {
    display: none;
}

@keyframes cq-sstv-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

/* 解码出来的画面：320×240，按行填进去 */
.cq-console__canvas {
    display: block;
    width: 100%;
    max-width: 640px;
    height: auto;
    margin: 0 0 14px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--ctl-radius);
}

/* SSTV 的行日志会一路长到 240 行，给它自己的滚动区 */
.cq-console__text--scroll {
    max-height: 176px;
    overflow-y: auto;
    scrollbar-width: thin;
}


/* --------------------------------------------------------------------------
   彩蛋已经发现过（html.cq-restored）
   --------------------------------------------------------------------------
   这里**不再隐藏**任何东西：整页都摆成"全解完"的样子（历史记录都留着，
   往上滚还能看回去），页面脚本只把那张解出来的卡滚到视口正中。
   标记在 <head> 里同步打上，所以首次绘制前就生效，不会先闪一下"从头走一遍"的界面。 */

/* --------------------------------------------------------------------------
   收尾：解析完成 → 解出来的图（可点）
   -------------------------------------------------------------------------- */
.cq-result {
    margin-top: 30px;
}

.cq-result img {
    cursor: pointer;
}

.cq-result img:focus-visible {
    outline: 2px solid rgba(255, 215, 0, 0.55);
    outline-offset: 4px;
}

.cq-result figcaption {
    margin-top: 10px;
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
}

/* 补在卡后面的空白：平时 0 高，页面脚本在"要把它滚到视口正中"时按需设高度
   （页面不够长的话，滚到页底就被夹住，正中就到不了）。见 main/cq.html 的 __cqCenterShot */
.cq-shot-pad {
    height: 0;
}

/* --------------------------------------------------------------------------
   原始卡片弹窗（点解出来的图才出现）
   -------------------------------------------------------------------------- */
.cq-modal {
    position: fixed;
    inset: 0;
    z-index: 200;                  /* 顶栏是 100，弹窗要压住它 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 6, 16, 0.82);
    backdrop-filter: blur(6px);
}

/* 显式写这一条：[hidden] 的 display:none 会被上面的 display:flex 盖掉 */
.cq-modal[hidden] {
    display: none;
}

.cq-modal__panel {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 22px 24px 24px;
    background: rgba(18, 18, 42, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--ctl-panel-radius);
}

.cq-modal__title {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 2px;
    color: #FFD700;
}

.cq-modal__img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--ctl-radius);
}

.cq-modal__note {
    margin: 12px 0 16px;
    font-size: 12px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.5);
}

.cq-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    color: var(--ctl-fg-dim);
    background: var(--ctl-bg);
    border: 1px solid var(--ctl-border);
    border-radius: var(--ctl-radius);
    cursor: pointer;
    transition: var(--ctl-transition);
}

.cq-modal__close:hover,
.cq-modal__close:focus-visible {
    color: var(--ctl-fg-hover);
    background: var(--ctl-bg-strong);
    border-color: var(--ctl-border-hover);
}

.cq-modal__dl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 20px;
    font-size: 14px;
    letter-spacing: 1px;
    text-decoration: none;
    color: var(--ctl-fg);
    background: var(--ctl-bg);
    border: 1px solid var(--ctl-border);
    border-radius: var(--ctl-radius);
    transition: var(--ctl-transition);
}

.cq-modal__dl:hover,
.cq-modal__dl:focus-visible {
    color: var(--ctl-fg-hover);
    background: var(--ctl-bg-strong);
    border-color: var(--ctl-border-hover);
}

html.cq-modal-open {
    overflow: hidden;                /* 弹窗打开时锁住背景滚动 */
}

/* --------------------------------------------------------------------------
   底部小提示：「彩蛋已发现」
   -------------------------------------------------------------------------- */
.cq-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 210;
    padding: 12px 20px;
    font-size: 13px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(18, 18, 42, 0.97);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: var(--ctl-panel-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 14px);
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}

.cq-toast.is-in {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s;
}

.cq-toast__dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 8px;
    border-radius: 1px;
    background: #FFD700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.85);
    vertical-align: 1px;
}

/* SSTV 收到的画面：整帧解完才显示（hidden 由脚本摘掉） */
.cq-screen {
    margin: 26px 0 0;
}

.cq-screen img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--ctl-panel-radius);
    background: rgba(0, 0, 0, 0.3);
}

.cq-screen figcaption {
    margin-top: 12px;
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
}

@media (max-width: 768px) {
    .cq-section {
        padding: 92px 16px 60px;
    }

    .cq-line,
    .cq-actions {
        font-size: 14px;
    }

    .cq-log {
        font-size: 11px;
    }

    .cq-console {
        padding: 14px 14px;
        font-size: 12px;
    }
}
