/* ============================================
 * preview.css — 问卷预览界面
 * 问卷研究工作室 · 多期追踪问卷工具
 *
 * 结构：顶栏白色 70px，底部 1px var(--st-line) 阴影
 *   左：提示（var(--st-accent)）+「此为预览页面，不能参与作答！」（var(--st-danger)）
 *   中：三枚 88×70 切换块（手机预览 / 电脑预览 / 关闭预览），选中态用主色
 *   右：复制发放链接（主色链） + 验证题目逻辑关系（复选框）
 *   主体：var(--st-bg) 背景 + 438×762 手机外框（屏幕 375×667，圆角 2px + 阴影）
 * 配色统一走 designer.css 里的 :root 调色板。
 * ============================================ */

.pv {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: #f5f7fa;
    display: flex;
    flex-direction: column;
    font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", "微软雅黑", sans-serif;
    color: #2c3e50;
}
.pv *, .pv *::before, .pv *::after { box-sizing: border-box; }

/* ---------------- 顶栏 ---------------- */
.pv-bar {
    flex: 0 0 auto;
    height: 70px;
    background: #fff;
    box-shadow: 0 1px 0 0 #e8ecf1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}
.pv-tip {
    padding-left: 40px;
    font-size: 14px;
    color: #888;
    line-height: 70px;
    white-space: nowrap;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pv-tip em { font-style: normal; color: var(--st-accent); }
.pv-tip span { color: var(--st-danger); }

.pv-switch {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    height: 70px;
}
.pv-switch-item {
    width: 88px;
    height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #fff;
    box-shadow: -1px 0 0 0 #eef1f5, 1px 0 0 0 #eef1f5;
    transition: background .15s;
}
.pv-switch-item + .pv-switch-item { box-shadow: 1px 0 0 0 #eef1f5; }
.pv-switch-item:hover { background: #fafbfc; }
.pv-switch-item.current { background: #2c3e7a; }
.pv-switch-item.current .pv-ic,
.pv-switch-item.current h5 { color: #fff; }
.pv-ic {
    height: 42px;
    line-height: 42px;
    font-size: 20px;
    color: #2c2c2c;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pv-ic svg { width: 22px; height: 22px; display: block; }
.pv-switch-item h5 {
    margin: 0;
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
    color: #2c3e50;
}

.pv-right {
    display: flex;
    align-items: center;
    gap: 22px;
    padding-right: 26px;
    font-size: 14px;
    flex: 0 0 auto;
}
.pv-link { color: #2c3e7a; cursor: pointer; text-decoration: underline; }
.pv-link:hover { color: #1a264f; }
.pv-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: #2c3e50; white-space: nowrap; }
.pv-check input { width: 15px; height: 15px; accent-color: #2c3e7a; cursor: pointer; }
.pv-check-short { display: none; }
.pv-help {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    border: 1px solid #b6bfc9; color: #8b98a5;
    font-size: 11px; cursor: help;
}
.pv-help:hover { border-color: #2c3e7a; color: #2c3e7a; }

/* ---------------- 舞台 ---------------- */
.pv-stage {
    flex: 1 1 auto;
    overflow: auto;
    padding: 34px 20px 60px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* ---- 手机外框（纯 CSS 绘制，不依赖图片） ---- */
.pv-phone {
    flex: 0 0 auto;
    width: 415px;
    height: 745px;
    background: #1c1c1e;
    border-radius: 42px;
    padding: 39px 20px 39px 20px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .26), 0 0 0 2px #d8d8dc inset;
    position: relative;
}
.pv-phone::before {   /* 听筒 */
    content: '';
    position: absolute;
    top: 20px; left: 50%;
    transform: translateX(-50%);
    width: 62px; height: 8px;
    background: #3a3a3c;
    border-radius: 4px;
}
.pv-phone::after {    /* Home 指示条 */
    content: '';
    position: absolute;
    bottom: 15px; left: 50%;
    transform: translateX(-50%);
    width: 118px; height: 5px;
    background: #4a4a4c;
    border-radius: 3px;
}
.pv-phone-screen {
    width: 375px;
    height: 667px;
    background: #fff;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.pv-scroll {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.pv-scroll::-webkit-scrollbar { width: 5px; }
.pv-scroll::-webkit-scrollbar-thumb { background: #ced7e0; border-radius: 3px; }

/* ---- 电脑外框：仿浏览器窗口 ---- */
.pv-browser {
    width: min(1080px, 100%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .16);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 168px);
}
.pv-browser-bar {
    flex: 0 0 auto;
    height: 40px;
    background: #f0f3f7;
    border-bottom: 1px solid #e4e9f0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
}
.pv-browser-dot { width: 11px; height: 11px; border-radius: 50%; }
.pv-browser-dot.r { background: #ff5f57; }
.pv-browser-dot.y { background: #febc2e; }
.pv-browser-dot.g { background: #28c840; }
.pv-browser-url {
    flex: 1 1 auto;
    margin-left: 12px;
    height: 24px;
    line-height: 24px;
    background: #fff;
    border: 1px solid #e4e9f0;
    border-radius: 12px;
    font-size: 12px;
    color: #8b98a5;
    padding: 0 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pv-browser-body { flex: 1 1 auto; overflow: auto; background: #fff; }
.pv-browser-body .qa-inner { max-width: 820px; }

/* 手机模式下隐藏滚动条以外的装饰，保持与真机一致 */
.pv-stage.mode-phone { padding-top: 42px; }

@media (max-width: 900px) {
    .pv-tip { display: none; }
    .pv-right { padding-right: 12px; gap: 12px; }
    .pv-right .pv-link { display: none; }
    .pv-phone { transform: scale(.92); transform-origin: top center; }
}
@media (max-width: 720px) {
    .pv-switch-item { width: 74px; }
    .pv-check-long { display: none; }
    .pv-check-short { display: inline; }
    .pv-right { gap: 8px; padding-right: 8px; font-size: 13px; }
    .pv-stage.mode-phone { padding: 16px 0 40px; }
    .pv-phone {
        width: 100%;
        max-width: 415px;
        height: auto;
        padding: 26px 12px;
        border-radius: 26px;
    }
    .pv-phone-screen { width: 100%; height: 78vh; }
    .pv-phone::before, .pv-phone::after { display: none; }
}
