/* ============================================================
   Hero 真机演示动画 — v2 全功能桌面端布局
   3 栏：章节树 / 编辑器 / 天工开物（人物 + 场景 + 工具）
   驱动：GSAP timeline（见 /landing/js/hero-animation.js）
   ============================================================ */

.hero-demo {
    margin-top: 60px;
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
    perspective: 1500px;
}

.hero-demo-frame {
    background: #fff;
    border-radius: 14px;
    box-shadow:
        0 30px 80px rgba(162, 59, 51, 0.18),
        0 0 0 1px var(--border);
    overflow: hidden;
    transform: rotateX(2deg);
    transform-origin: center top;
}

/* ============ macOS 标题栏 ============ */
.hero-demo-chrome {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #f6f6f6, #ebebeb);
    border-bottom: 1px solid #d8d8d8;
}
.hero-demo-traffic { display: flex; gap: 8px; }
.hero-demo-traffic span {
    width: 12px; height: 12px; border-radius: 50%; display: block;
}
.t-red    { background: #ff5f57; }
.t-yellow { background: #febc2e; }
.t-green  { background: #28c840; }

.hero-demo-title {
    flex: 1; text-align: center; font-size: 12px; color: #666;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}
.hero-demo-title strong { color: #222; font-weight: 600; }
.hero-demo-title .sep { color: #ccc; margin: 0 6px; }

/* ============ 顶部工具栏 ============ */
.hero-demo-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: #fafafa;
    border-bottom: 1px solid #e8e8e8;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
    font-size: 12px;
}
.hero-demo-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    flex-shrink: 0;
}
.hero-demo-tool-btn:hover {
    background: rgba(162, 59, 51, 0.06);
    color: var(--brand);
}
.hero-demo-tool-btn:active {
    transform: scale(0.96);
    background: rgba(162, 59, 51, 0.12);
}
.hero-demo-tool-btn.active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}
.hero-demo-tool-btn .ico {
    width: 14px; height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.hero-demo-tool-spacer { flex: 1; }
.hero-demo-save-status {
    color: #999;
    font-size: 11px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.hero-demo-save-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #28c840;
    display: inline-block;
}

/* ============ 三栏主体 ============ */
.hero-demo-body {
    display: grid;
    grid-template-columns: 200px 1fr 260px;
    min-height: 460px;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}

/* === 左：章节树 === */
.hero-demo-sidebar {
    background: #faf7f4;
    border-right: 1px solid #efe6dd;
    padding: 16px 0;
    font-size: 13px;
}
.hero-demo-sidebar-section {
    padding: 0 14px;
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 12px 0 6px;
    font-weight: 600;
}
.hero-demo-sidebar-section:first-child { margin-top: 0; }
.hero-demo-chapter-item {
    padding: 6px 14px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
    border-left: 3px solid transparent;
    cursor: default;
}
.hero-demo-chapter-item .ch-num {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: #aaa;
    width: 24px;
}
.hero-demo-chapter-item .ch-name { flex: 1; }
.hero-demo-chapter-item.active {
    background: #fff;
    color: var(--brand);
    border-left-color: var(--brand);
    font-weight: 600;
}
.hero-demo-chapter-item.active .ch-num { color: var(--brand); }
.hero-demo-chapter-item .ch-words {
    font-size: 10px;
    color: #ccc;
    font-family: ui-monospace, monospace;
}

/* === 中：编辑器 === */
.hero-demo-editor-wrap {
    padding: 36px 56px;
    background: #fff;
    overflow: hidden;
    position: relative;
}

.hero-demo-editor-wrap h2.chapter-title {
    font-family: 'Source Han Serif SC', 'Songti SC', serif;
    font-size: 22px;
    font-weight: 900;
    color: var(--brand);
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: 1px;
}

.hero-demo-line {
    font-family: 'Source Han Serif SC', 'Songti SC', serif;
    font-size: 17px;
    line-height: 2;
    color: #1a1a1a;
    text-indent: 2em;
    margin-bottom: 4px;
    min-height: 1.8em;
}

/* typing 光标 */
.typing-caret {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--brand);
    vertical-align: text-bottom;
    margin-left: 1px;
    animation: caret-blink 1s steps(2) infinite;
}
@keyframes caret-blink {
    50% { opacity: 0; }
}

/* 引用 chip */
.hero-demo-chip {
    display: inline-block;
    padding: 1px 8px;
    margin: 0 1px;
    background: linear-gradient(135deg, #fff0eb, #fbe5dd);
    color: var(--brand);
    border-radius: 5px;
    font-size: 0.92em;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
    border: 1px solid rgba(162, 59, 51, 0.18);
    cursor: default;
    transition: background 0.2s;
}
.hero-demo-chip.highlight {
    background: linear-gradient(135deg, var(--brand), var(--pink));
    color: #fff;
    box-shadow: 0 4px 12px rgba(162, 59, 51, 0.35);
}

/* 选中态高亮 */
.hero-demo-line.selected {
    background: linear-gradient(120deg, #fff5d6, #fff5d6);
    box-shadow: 0 0 0 4px #fff5d6;
    border-radius: 4px;
}

/* === Ctrl+K popover === */
.hero-demo-popover {
    position: absolute;
    left: 56px;
    right: 56px;
    top: 220px;
    background: #fff;
    border-radius: 12px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.22),
        0 0 0 1px rgba(0, 0, 0, 0.08);
    padding: 14px 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}
.hero-demo-popover-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 11px;
    border-bottom: 1px solid #f0e4dc;
}
.hero-demo-popover-bar .kbd {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: linear-gradient(180deg, #1a1310, #4a4a4a);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 5px;
    font-family: ui-monospace, monospace;
}
.hero-demo-popover-input {
    flex: 1;
    font-size: 14px;
    color: #555;
    min-height: 1.4em;
}
.caret-input {
    display: inline-block;
    width: 1.5px;
    height: 1em;
    background: #999;
    vertical-align: text-bottom;
    animation: caret-blink 1s steps(2) infinite;
}

.hero-demo-diff {
    margin-top: 11px;
    font-size: 13px;
    line-height: 1.85;
    color: #1a1a1a;
    font-family: 'Source Han Serif SC', 'Songti SC', serif;
}
.hero-demo-diff .del {
    background: #ffe9e7;
    color: #c4302b;
    text-decoration: line-through;
    text-decoration-color: rgba(196, 48, 43, 0.4);
    padding: 0 2px;
    border-radius: 2px;
}
.hero-demo-diff .ins {
    background: #e3f9e5;
    color: #22863a;
    padding: 0 2px;
    border-radius: 2px;
}
.hero-demo-diff-actions {
    margin-top: 11px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.hero-demo-diff-actions button {
    padding: 5px 14px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    font-family: inherit;
}
.btn-accept {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
}
.btn-reject {
    background: #f3f3f3;
    color: #555;
}

/* === 右：天工开物 === */
.hero-demo-sidebar-right {
    background: #fefaf6;
    border-left: 1px solid #efe6dd;
    padding: 16px 14px;
    font-size: 12px;
    overflow-y: hidden;
}
.hero-demo-panel-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #1a1310;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #efe6dd;
}
.hero-demo-group {
    margin-bottom: 14px;
}
.hero-demo-group-title {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.hero-demo-group-title .count {
    background: #f0e4dc;
    color: var(--brand);
    border-radius: 999px;
    padding: 0 6px;
    font-size: 10px;
    font-weight: 600;
}

/* 人物卡片 */
.hero-demo-char-card {
    display: flex;
    gap: 10px;
    padding: 9px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid transparent;
    transition: all 0.3s;
    cursor: default;
}
.hero-demo-char-card.highlight {
    border-color: var(--brand);
    box-shadow: 0 6px 18px rgba(162, 59, 51, 0.18);
    transform: translateX(-2px);
}
.hero-demo-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--pink));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Source Han Serif SC', 'Songti SC', serif;
    flex-shrink: 0;
}
.hero-demo-char-card.zhou .hero-demo-avatar {
    background: linear-gradient(135deg, #7a6655, #555);
}
.hero-demo-char-card.lin .hero-demo-avatar {
    background: linear-gradient(135deg, #9B5DE5, #6B8BFB);
}
.hero-demo-char-info { flex: 1; min-width: 0; }
.hero-demo-char-name {
    font-size: 13px;
    font-weight: 700;
    color: #1a1310;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.hero-demo-char-name .role-tag {
    font-size: 9px;
    background: var(--brand);
    color: #fff;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0;
}
.hero-demo-char-tags {
    font-size: 10px;
    color: var(--brand);
    margin-bottom: 3px;
}
.hero-demo-char-tags span {
    display: inline-block;
    padding: 1px 5px;
    background: var(--brand-soft);
    border-radius: 3px;
    margin-right: 2px;
}
.hero-demo-char-meta {
    font-size: 10px;
    color: #999;
}

/* 场景卡片 */
.hero-demo-scene-card {
    padding: 7px 10px;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 12px;
    color: #555;
    border-left: 3px solid var(--gold);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hero-demo-scene-card .scene-name { font-weight: 600; color: #1a1310; }
.hero-demo-scene-card .scene-count { font-size: 10px; color: #aaa; }

/* 道具卡片 */
.hero-demo-item-card {
    padding: 6px 10px;
    background: #fff;
    border-radius: 6px;
    font-size: 12px;
    color: #555;
    border-left: 3px solid var(--purple);
    margin-bottom: 4px;
}
.hero-demo-item-card .item-name {
    font-weight: 600;
    color: #1a1310;
}

/* 工具按钮组（右下角） */
.hero-demo-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #efe6dd;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.hero-demo-action-btn {
    padding: 6px 8px;
    background: #fff;
    border: 1px solid #efe6dd;
    border-radius: 6px;
    font-size: 11px;
    color: #555;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
    user-select: none;
}
.hero-demo-action-btn:hover {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: var(--brand);
    transform: translateY(-1px);
}
.hero-demo-action-btn:active { transform: scale(0.96); }

/* 点击 toast 反馈 */
.hero-demo-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 19, 16, 0.92);
    color: #fff;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    pointer-events: none;
    opacity: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============ 底部状态栏 ============ */
.hero-demo-statusbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 6px 14px;
    background: #f5efe9;
    border-top: 1px solid #e8ddd4;
    font-size: 11px;
    color: #777;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}
.hero-demo-statusbar .item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.hero-demo-statusbar .item strong {
    color: var(--brand);
    font-weight: 700;
    font-family: ui-monospace, monospace;
}
.hero-demo-statusbar .spacer { flex: 1; }
.hero-demo-statusbar .kbd-hint {
    font-family: ui-monospace, monospace;
    color: #999;
    font-size: 10px;
}
.hero-demo-statusbar .kbd-hint kbd {
    display: inline-block;
    padding: 1px 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 10px;
    color: #555;
    margin: 0 1px;
}

/* 步骤气泡标签（屏幕右上角浮动） */
.hero-demo-step {
    position: absolute;
    top: 16px;
    right: 20px;
    background: linear-gradient(135deg, var(--brand), var(--pink));
    color: #fff;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(162, 59, 51, 0.3);
    opacity: 0;
    z-index: 10;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.hero-demo-step svg { flex-shrink: 0; }

/* tool-btn 里的 svg 对齐 */
.hero-demo-tool-btn svg { flex-shrink: 0; }
.hero-demo-panel-title svg { flex-shrink: 0; }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
    .hero-demo-body { grid-template-columns: 170px 1fr 220px; }
    .hero-demo-editor-wrap { padding: 28px 36px; }
}

@media (max-width: 900px) {
    /* 平板/竖屏：隐藏左 sidebar，保留右天工开物 */
    .hero-demo-body { grid-template-columns: 1fr 200px; }
    .hero-demo-sidebar { display: none; }
    .hero-demo-editor-wrap { padding: 24px 26px; min-height: 380px; }
    .hero-demo-line { font-size: 16px; line-height: 1.95; }
    .hero-demo-popover { left: 26px; right: 26px; top: 180px; }
    .hero-demo-toolbar { overflow-x: auto; flex-wrap: nowrap; }
}

@media (max-width: 640px) {
    /* 手机：单栏正文，工具栏横滚单行 */
    .hero-demo { margin-top: 36px; }
    .hero-demo-frame { border-radius: 10px; transform: none; }
    .hero-demo-body { grid-template-columns: 1fr; min-height: auto; }
    .hero-demo-sidebar { display: none; }
    .hero-demo-sidebar-right {
        border-left: none;
        border-top: 1px solid #efe6dd;
        padding: 12px 14px;
        max-height: 220px;
        overflow: hidden;
    }
    .hero-demo-chrome { padding: 8px 10px; }
    .hero-demo-title { font-size: 10px; }
    .hero-demo-title .sep { margin: 0 3px; }

    /* 工具栏 — 横滚单行，避免文字换行 */
    .hero-demo-toolbar {
        padding: 6px 10px;
        font-size: 11px;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .hero-demo-toolbar::-webkit-scrollbar { display: none; }
    .hero-demo-tool-btn {
        padding: 4px 8px;
        gap: 3px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .hero-demo-tool-spacer { display: none; }
    .hero-demo-save-status {
        flex-shrink: 0;
        margin-left: auto;
        padding-left: 12px;
    }

    .hero-demo-editor-wrap { padding: 18px 14px 22px; min-height: 280px; }
    .hero-demo-editor-wrap h2.chapter-title { font-size: 17px; margin-bottom: 12px; }
    .hero-demo-line { font-size: 14px; line-height: 1.85; }
    .hero-demo-popover { left: 12px; right: 12px; top: 130px; padding: 12px; }
    .hero-demo-diff { font-size: 12px; }
    .hero-demo-statusbar {
        padding: 5px 10px;
        font-size: 10px;
        gap: 10px;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }
    .hero-demo-statusbar::-webkit-scrollbar { display: none; }
    .hero-demo-statusbar .item { flex-shrink: 0; }
    .hero-demo-statusbar .kbd-hint { display: none; }
    .hero-demo-step { top: 10px; right: 10px; padding: 4px 10px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-demo-frame { transform: none; }
    .typing-caret, .caret-input { animation: none; opacity: 0.5; }
}
