/* ==========================================================================
   水柔打字机 · 站点样式
   深色主题，与应用界面（深色面板 + 青色强调）保持一致
   ========================================================================== */

:root {
    --bg: #0d1017;
    --bg-soft: #141922;
    --panel: #161b26;
    --panel-2: #1c222f;
    --border: #262e3d;
    --text: #e8edf5;
    --text-dim: #9aa7bb;
    --text-faint: #6b7789;
    --accent: #4fd1c5;
    --accent-2: #38a3f0;
    --accent-dim: rgba(79, 209, 197, .14);
    --radius: 14px;
    --fade: 200ms;
    --wrap: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    /* 用系统字体：不下载字体就不会有字体闪烁（FOUT） */
    font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei",
                 "PingFang SC", "Hiragino Sans GB", sans-serif;
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   页面切换：淡出淡入，避免「突然变化」
   默认状态写在 JS 里加上的 .js-anim 下 —— 没有 JS 时页面照样完整可见
   -------------------------------------------------------------------------- */
.js-anim body { opacity: 0; }

/* 淡入用 animation，不用 transition。
   transition 要先观察到一个"起始帧"再改值才会动，而在不渲染的场合
   （标签页在后台、窗口最小化、离屏 iframe）整段可能被跳过，
   页面就停在透明状态 —— 用户看到的是全白。
   animation 是按时间走的，不依赖渲染循环的中途观察，一定会播完。 */
.js-anim.ready body {
    opacity: 1;
    animation: page-in var(--fade) ease both;
}
@keyframes page-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* 跳走时的淡出可以放心用 transition：页面马上就要卸载了 */
.js-anim.leaving body {
    opacity: 0;
    transition: opacity 150ms ease;
}

@media (prefers-reduced-motion: reduce) {
    .js-anim body,
    .js-anim.ready body,
    .js-anim.leaving body { opacity: 1; transition: none; animation: none !important; }
    .caret { animation: none !important; }
}

/* --------------------------------------------------------------------------
   通用
   -------------------------------------------------------------------------- */
.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 22px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.3; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(28px, 5vw, 46px); letter-spacing: -.5px; }
h2 { font-size: clamp(22px, 3.4vw, 30px); }
h3 { font-size: 18px; }
p { margin: 0 0 1em; color: var(--text-dim); }
strong { color: var(--text); }

code {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 6px;
    font-size: .9em;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    color: var(--text);
}

/* --------------------------------------------------------------------------
   hidden 属性必须真的隐藏

   HTML 的 hidden 靠浏览器默认样式 [hidden] { display: none } 生效，
   而**作者样式优先级更高** —— 只要给同一个元素写了 display: flex / block，
   那一条就被覆盖，元素照样显示出来（会留下一个空框）。
   .note 就是 display: flex，所以教学页那个 hidden 的提示块一直是个空框。
   -------------------------------------------------------------------------- */
[hidden] {
    display: none !important;
}

/* --------------------------------------------------------------------------
   顶栏
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 22px;
    background: rgba(13, 16, 23, .82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    color: var(--text);
    font-size: 16px;
}
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; display: block; }

.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
    padding: 7px 14px;
    border-radius: 9px;
    color: var(--text-dim);
    font-size: 15px;
}
.site-nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.site-nav a.is-active { color: var(--accent); background: var(--accent-dim); }

/* 右上角下载按钮 */
.site-header .btn { margin-left: 6px; }

/* --------------------------------------------------------------------------
   按钮
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); background: #232b3a; }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    color: #08141a;
}
.btn-primary:hover { background: linear-gradient(135deg, #62ded2, #4bb0f5); }

.btn-sm { padding: 8px 15px; font-size: 14px; }
.btn-lg { padding: 15px 26px; font-size: 16px; width: 100%; }
.btn-ghost { background: transparent; }

/* --------------------------------------------------------------------------
   区块
   -------------------------------------------------------------------------- */
.section { padding: 68px 0; }
.section-tight { padding: 46px 0; }
.section-head { max-width: 620px; margin-bottom: 34px; }

.hero {
    padding: 74px 0 58px;
    background:
        radial-gradient(900px 380px at 18% -10%, rgba(79, 209, 197, .13), transparent 62%),
        radial-gradient(760px 340px at 88% 0%, rgba(56, 163, 240, .12), transparent 60%);
    border-bottom: 1px solid var(--border);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    align-items: center;
}
@media (min-width: 940px) {
    .hero-grid { grid-template-columns: 1.02fr .98fr; gap: 52px; }
}

.hero p.lead { font-size: 17px; color: var(--text-dim); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.pill {
    display: inline-block;
    padding: 4px 11px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   对话框演示（复刻应用里的 Galgame 风格面板）
   -------------------------------------------------------------------------- */
.demo {
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(18, 22, 36, .82);
    padding: 20px 22px 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.demo-name {
    display: inline-block;
    padding: 3px 14px;
    border-radius: 9px;
    background: rgba(79, 209, 197, .96);
    color: #0d1b22;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
}

.demo-text {
    min-height: 96px;
    font-size: 17px;
    line-height: 1.75;
    color: #f2f5f8;
}

.caret {
    display: inline-block;
    width: 8px;
    height: 1.05em;
    margin-left: 2px;
    vertical-align: -2px;
    background: var(--accent);
    animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.demo-sep { height: 1px; background: rgba(255, 255, 255, .2); margin: 10px 0 8px; }

.demo-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 2px;
    font-size: 12px;
    color: #c3ccda;
}
/* 底部这一排只是复刻应用里的外观，功能本身没有实现，
   所以刻意做成静止的：不轮流高亮、不加悬停效果，免得看起来像能点 */
.demo-menu span {
    padding: 3px 6px;
    border-radius: 6px;
    opacity: .72;
}

/* --------------------------------------------------------------------------
   卡片
   -------------------------------------------------------------------------- */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 940px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
}
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.card .ico {
    display: block;
    font-size: 20px;
    margin-bottom: 10px;
}

/* --------------------------------------------------------------------------
   下载页
   -------------------------------------------------------------------------- */
.dl-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
@media (min-width: 820px) { .dl-grid { grid-template-columns: 1fr 1fr; } }

.dl-card {
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.dl-card.recommended { border-color: rgba(79, 209, 197, .45); }

.dl-tag {
    align-self: flex-start;
    padding: 3px 10px;
    margin-bottom: 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--accent-dim);
    color: var(--accent);
}
.dl-tag.plain { background: var(--panel-2); color: var(--text-faint); }

.dl-card h3 { font-size: 19px; margin-bottom: 6px; }
.dl-card p { font-size: 14.5px; }
.dl-card .btn { margin-top: auto; }

.dl-meta {
    margin: 4px 0 18px;
    font-size: 13px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

/* 对比表 */
.table-wrap { overflow-x: auto; }
table.cmp {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
    min-width: 560px;
}
table.cmp th, table.cmp td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table.cmp thead th {
    color: var(--text);
    font-size: 13px;
    letter-spacing: .3px;
    text-transform: uppercase;
    background: var(--bg-soft);
}
table.cmp tbody th {
    font-weight: 600;
    color: var(--text-dim);
    white-space: nowrap;
}
table.cmp td { color: var(--text-dim); }
table.cmp .yes { color: var(--accent); font-weight: 600; }
table.cmp .no { color: var(--text-faint); }

/* 提示块 */
.note {
    display: flex;
    gap: 12px;
    padding: 15px 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    font-size: 14.5px;
    color: var(--text-dim);
}
.note strong { color: var(--text); }
.note .ico { flex: 0 0 auto; }

ol.steps { padding-left: 22px; color: var(--text-dim); }
ol.steps li { margin-bottom: 9px; }
ol.steps li strong { color: var(--text); }

/* --------------------------------------------------------------------------
   教学页：视频播放器 + 分步教学
   -------------------------------------------------------------------------- */
.video-frame {
    position: relative;
    width: 100%;
    /* 用 padding-bottom 撑出 16:9，比 aspect-ratio 兼容性更稳 */
    padding-bottom: 56.25%;
    height: 0;
    background: #000;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.video-frame video,
.video-frame iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.video-meta {
    margin: 12px 0 0;
    font-size: 13.5px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

/* 视频确实不存在（404）时才把空播放器收起来；
   如果只是这台设备解不了，播放器要留着 —— 文件是好的，用户还能直接打开 */
.video-frame.is-missing { display: none; }

/* 出错提示：放在播放器下方，不覆盖播放器 */
.video-note { margin-top: 16px; }
.video-note a { color: var(--accent); }
.video-note code { font-size: .88em; }

/* 分步教学 */
ol.lesson {
    counter-reset: lesson;
    list-style: none;
    padding: 0;
    margin: 0;
}
ol.lesson > li {
    position: relative;
    padding-left: 46px;
    margin-bottom: 22px;
    color: var(--text-dim);
}
ol.lesson > li::before {
    counter-increment: lesson;
    content: counter(lesson);
    position: absolute;
    left: 0;
    top: 1px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
}
ol.lesson > li strong { color: var(--text); }
ol.lesson > li p { margin: 4px 0 0; }
ol.lesson > li p:last-child { margin-bottom: 0; }

/* 章节跳转：点了跳到视频对应时间点 */
.chapters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.chapters button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--text-dim);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.chapters button:hover { background: #232b3a; color: var(--text); border-color: #33405a; }
.chapters button .t {
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   常见问题：一直展开显示，不做折叠

   区分"问题"和"答案"靠三件事叠起来，单靠一样都不够：
     1. 字号差得够开（问题 17.5px / 答案 14px）
     2. 颜色一明一暗（问题接近纯白 / 答案压暗）
     3. **问题下面有一条分隔线** —— 这条最关键。
        只靠字体的话，问题→答案的间距和答案内部段落间距看起来一样，
        整块会读成一段连续正文，分不出哪句是问、哪句是答。
   （顺带：中文用的是微软雅黑，只有 Regular / Bold 两档，
     所以 font-weight 给 700 以上没有意义，不会再粗。）
   -------------------------------------------------------------------------- */
.qa-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.qa {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 22px 18px 24px;
    border-left: 3px solid rgba(79, 209, 197, .55);
    transition: border-color 140ms ease, background 140ms ease;
}
.qa:hover {
    background: var(--panel-2);
    border-left-color: var(--accent);
}

/* ---- 问题：当作小标题来做 ---- */
.qa-q {
    margin: 0 0 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);   /* ← 和答案之间的分隔线 */
    font-size: 17.5px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: .2px;
    color: var(--text);
}
.qa-num {
    display: inline-block;
    min-width: 50px;
    color: var(--accent);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ---- 答案：明显小一号、暗一档，段落之间收紧，读起来是一整块 ---- */
.qa-a {
    position: relative;
    padding-left: 50px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.75;
    color: var(--text-dim);
}
.qa-a::before {
    content: "A：";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--accent);
    font-size: 1em;
    font-weight: 700;
    opacity: .7;
}
/* 答案内部的段落间距要**明显小于**上面那条分隔线带来的间隔 */
.qa-a p { margin: 0 0 .5em; }
.qa-a p:last-child { margin-bottom: 0; }
.qa-a code { font-size: .9em; }

/* 窄屏：整体缩一点，但两列仍然对齐（列宽 42px） */
@media (max-width: 560px) {
    .qa { padding: 14px 16px 16px 18px; }
    .qa-num { min-width: 42px; }
    .qa-q { font-size: 16.5px; padding-bottom: 10px; margin-bottom: 13px; }
    .qa-a { padding-left: 42px; font-size: 13.5px; }
}

/* --------------------------------------------------------------------------
   页脚
   -------------------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 30px 0 40px;
    font-size: 14px;
    color: var(--text-faint);
}
.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.site-footer a { color: var(--text-dim); }

.site-footer .footer-nav {
    display: flex;
    gap: 14px;
    margin-left: auto;      /* 导航推到右边，备案号跟在版权后面 */
}

/* 备案号：按法规必须展示，并且要能点进工信部网站。
   它和正文一样放在 <a> 里，但压暗一档，不抢视线。 */
.site-footer .icp {
    font-size: 13px;
    color: var(--text-faint);
}
.site-footer .icp:hover { color: var(--text-dim); }
