/* =====================================================
   假设发生器 - 样式表
   ===================================================== */

/* ---- CSS 变量 ---- */
:root {
    --hg-primary: #7c3aed;
    --hg-primary-hover: #6d28d9;
    --hg-primary-light: #f5f3ff;
    --hg-accent: #0ea5e9;
    --hg-success: #059669;
    --hg-warning: #d97706;
    --hg-danger: #dc2626;
    --hg-bg: #f8fafc;
    --hg-surface: #ffffff;
    --hg-border: #e2e8f0;
    --hg-text: #1e293b;
    --hg-text-muted: #64748b;
    --hg-text-light: #94a3b8;
    --hg-shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --hg-shadow-md: 0 4px 12px rgba(0,0,0,.10);
    --hg-shadow-lg: 0 8px 24px rgba(0,0,0,.12);
    --hg-radius: 10px;
    --hg-radius-sm: 6px;
    --hg-toolbar-h: 48px;
    --hg-transition: 0.2s ease;
}

/* 暗色主题 */
.hg-dark {
    --hg-primary: #a78bfa;
    --hg-primary-hover: #8b5cf6;
    --hg-primary-light: #2d1b69;
    --hg-bg: #0f172a;
    --hg-surface: #1e293b;
    --hg-border: #334155;
    --hg-text: #e2e8f0;
    --hg-text-muted: #94a3b8;
    --hg-text-light: #64748b;
    --hg-shadow-sm: 0 1px 3px rgba(0,0,0,.30);
    --hg-shadow-md: 0 4px 12px rgba(0,0,0,.35);
    --hg-shadow-lg: 0 8px 24px rgba(0,0,0,.40);
}

/* ---- 全屏模式 ---- */
.hg-container.is-fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    border-radius: 0;
}

/* ---- 全局容器 ---- */
.hg-container {
    display: flex;
    flex-direction: column;
    background: var(--hg-bg);
    border-radius: var(--hg-radius);
    overflow: hidden;
    box-shadow: var(--hg-shadow-lg);
    min-height: 640px;
    border: 1px solid var(--hg-border);
    transition: background var(--hg-transition), border-color var(--hg-transition);
}

/* ---- 工具栏 ---- */
.hg-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    height: var(--hg-toolbar-h);
    background: var(--hg-surface);
    border-bottom: 1px solid var(--hg-border);
    flex-wrap: wrap;
    min-height: var(--hg-toolbar-h);
    transition: background var(--hg-transition), border-color var(--hg-transition);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.toolbar-group--right {
    margin-left: auto;
}

.hg-toolbar-btn {
    padding: 5px 11px;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius-sm);
    background: var(--hg-surface);
    color: var(--hg-text);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--hg-transition);
    white-space: nowrap;
}

.hg-toolbar-btn:hover {
    background: var(--hg-primary-light);
    border-color: var(--hg-primary);
    color: var(--hg-primary);
}

.hg-toolbar-btn--ai {
    background: linear-gradient(135deg, #7c3aed, #0ea5e9);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}

.hg-toolbar-btn--ai:hover {
    background: linear-gradient(135deg, #6d28d9, #0284c7);
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
}

/* ---- 主内容区三列布局 ---- */
.hg-main-content {
    display: grid;
    grid-template-columns: 220px 1fr 1fr;
    min-height: 600px;
    overflow: hidden;
}

/* ---- 历史记录面板 ---- */
.hg-history-panel {
    border-right: 1px solid var(--hg-border);
    display: flex;
    flex-direction: column;
    background: var(--hg-surface);
    overflow: hidden;
    transition: background var(--hg-transition), border-color var(--hg-transition);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
    border-bottom: 1px solid var(--hg-border);
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--hg-text);
}

.history-clear-btn {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--hg-border);
    background: transparent;
    color: var(--hg-text-muted);
    cursor: pointer;
    transition: all var(--hg-transition);
}

.history-clear-btn:hover {
    border-color: var(--hg-danger);
    color: var(--hg-danger);
}

.history-search {
    padding: 8px 10px;
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 5px 10px;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius-sm);
    font-size: 12px;
    background: var(--hg-bg);
    color: var(--hg-text);
    box-sizing: border-box;
    outline: none;
    transition: border-color var(--hg-transition);
}

.history-search input:focus {
    border-color: var(--hg-primary);
}

.history-search-wrap {
    position: relative;
}

.history-search-wrap input {
    padding-right: 28px;
}

.history-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--hg-text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 0 2px;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 10px;
    text-align: center;
    color: var(--hg-text-light);
}

.history-empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.history-empty-main {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.history-empty-sub {
    font-size: 11px;
}

.history-item {
    padding: 9px 28px 9px 10px;
    border-radius: var(--hg-radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    margin-bottom: 4px;
    transition: all var(--hg-transition);
    position: relative;
}

.history-item:hover {
    background: var(--hg-primary-light);
    border-color: var(--hg-primary);
}

.history-item.active {
    background: var(--hg-primary-light);
    border-color: var(--hg-primary);
}

.history-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--hg-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.history-item-hypothesis {
    font-size: 11px;
    color: var(--hg-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.history-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-item-date {
    font-size: 10px;
    color: var(--hg-text-light);
}

.history-item-score { font-size: 11px; font-weight: 700; color: var(--hg-primary); }
.history-item-score.score-high { color: #059669; }
.history-item-score.score-mid  { color: #d97706; }
.history-item-score.score-low  { color: #ef4444; }

.history-item-del {
    position: absolute;
    right: 6px;
    top: 8px;
    font-size: 10px;
    color: var(--hg-text-light);
    border: none;
    background: none;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0;
    transition: opacity var(--hg-transition);
}

.history-item:hover .history-item-del {
    opacity: 1;
    color: var(--hg-danger);
}

/* ---- 配置表单面板 ---- */
.hg-editor-panel {
    border-right: 1px solid var(--hg-border);
    display: flex;
    flex-direction: column;
    background: var(--hg-bg);
    overflow: hidden;
    transition: background var(--hg-transition), border-color var(--hg-transition);
}

.editor-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--hg-surface);
    border-bottom: 1px solid var(--hg-border);
    flex-shrink: 0;
}

.editor-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--hg-text);
}

.editor-panel-meta {
    font-size: 11px;
    color: var(--hg-text-muted);
}

.hg-form {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.hg-form::-webkit-scrollbar { width: 4px; }
.hg-form::-webkit-scrollbar-track { background: transparent; }
.hg-form::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.hg-form-group {
    margin-bottom: 14px;
}

.hg-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.hg-form-group--half {
    margin-bottom: 0;
}

.hg-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--hg-text);
    margin-bottom: 5px;
}

.hg-label-hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--hg-text-muted);
    margin-left: 4px;
}

.required-mark {
    color: var(--hg-danger);
    margin-left: 2px;
}

.hg-input,
.hg-select,
.hg-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius-sm);
    font-size: 13px;
    background: var(--hg-surface);
    color: var(--hg-text);
    box-sizing: border-box;
    outline: none;
    transition: border-color var(--hg-transition), box-shadow var(--hg-transition);
    font-family: inherit;
}

.hg-input:focus,
.hg-select:focus,
.hg-textarea:focus {
    border-color: var(--hg-primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,.10);
}

.hg-textarea {
    resize: vertical;
    line-height: 1.6;
}

.hg-textarea--sm {
    resize: vertical;
}

.hg-char-counter {
    font-size: 11px;
    color: var(--hg-text-muted);
    text-align: right;
    margin-top: 3px;
}

.hg-char-counter.warn { color: var(--hg-warning); }
.hg-char-counter.danger { color: var(--hg-danger); }

/* ---- 推演深度选择 ---- */
.hg-depth-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.hg-depth-item {
    cursor: pointer;
}

.hg-depth-item input[type="radio"] {
    display: none;
}

.hg-depth-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    border: 2px solid var(--hg-border);
    border-radius: var(--hg-radius-sm);
    background: var(--hg-surface);
    cursor: pointer;
    transition: all var(--hg-transition);
    text-align: center;
}

.hg-depth-item input:checked + .hg-depth-card {
    border-color: var(--hg-primary);
    background: var(--hg-primary-light);
}

.hg-depth-card:hover {
    border-color: var(--hg-primary);
}

.depth-icon {
    font-size: 18px;
    margin-bottom: 4px;
}

.depth-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--hg-text);
    display: block;
    margin-bottom: 3px;
}

.depth-desc {
    font-size: 10px;
    color: var(--hg-text-muted);
    line-height: 1.4;
}

/* ---- 分析视角选择 ---- */
.hg-perspective-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.hg-perspective-item {
    cursor: pointer;
}

.hg-perspective-item input[type="radio"] {
    display: none;
}

.hg-perspective-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 6px;
    border: 2px solid var(--hg-border);
    border-radius: var(--hg-radius-sm);
    background: var(--hg-surface);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--hg-text);
    text-align: center;
    transition: all var(--hg-transition);
}

.hg-perspective-card small {
    font-size: 10px;
    font-weight: 400;
    color: var(--hg-text-muted);
    display: block;
    line-height: 1.3;
}

.hg-perspective-item input:checked + .hg-perspective-card {
    border-color: var(--hg-primary);
    background: var(--hg-primary-light);
}

.hg-perspective-card:hover {
    border-color: var(--hg-primary);
}

/* ---- 操作按钮区 ---- */
.hg-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.hg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--hg-radius-sm);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--hg-transition);
}

.hg-btn--primary {
    background: linear-gradient(135deg, #7c3aed, #0ea5e9);
    color: #fff;
}

.hg-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(124,58,237,.40);
}

.hg-btn--secondary {
    background: var(--hg-surface);
    color: var(--hg-text-muted);
    border: 1px solid var(--hg-border);
}

.hg-btn--secondary:hover {
    border-color: var(--hg-primary);
    color: var(--hg-primary);
    background: var(--hg-primary-light);
}

/* ---- 结果预览面板 ---- */
.hg-preview-panel {
    display: flex;
    flex-direction: column;
    background: var(--hg-bg);
    overflow: hidden;
    transition: background var(--hg-transition);
    position: relative;
}

.preview-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--hg-surface);
    border-bottom: 1px solid var(--hg-border);
    flex-shrink: 0;
}

.preview-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--hg-text);
}

.preview-panel-actions {
    display: flex;
    gap: 6px;
}

.preview-action-btn {
    padding: 4px 10px;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius-sm);
    background: var(--hg-surface);
    color: var(--hg-text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--hg-transition);
}

.preview-action-btn:hover {
    border-color: var(--hg-primary);
    color: var(--hg-primary);
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.preview-content::-webkit-scrollbar { width: 4px; }
.preview-content::-webkit-scrollbar-track { background: transparent; }
.preview-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: var(--hg-text-muted);
}

.preview-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
    animation: hgFloat 2.8s ease-in-out infinite;
}

@keyframes hgFloat {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.preview-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--hg-text);
    margin-bottom: 8px;
}

.preview-empty-hint {
    font-size: 13px;
    color: var(--hg-text-muted);
    line-height: 1.6;
}

/* ---- 加载状态 ---- */
.preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(4px);
    z-index: 10;
    gap: 12px;
}

.hg-dark .preview-loading {
    background: rgba(15,23,42,.88);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--hg-border);
    border-top-color: var(--hg-primary);
    border-radius: 50%;
    animation: hgSpin 0.8s linear infinite;
}

@keyframes hgSpin {
    to { transform: rotate(360deg); }
}

.loading-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--hg-text);
}

.loading-hint {
    font-size: 12px;
    color: var(--hg-text-muted);
    text-align: center;
    max-width: 260px;
    line-height: 1.5;
}

.cancel-generate-btn {
    padding: 6px 16px;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius-sm);
    background: var(--hg-surface);
    color: var(--hg-text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--hg-transition);
}

.cancel-generate-btn:hover {
    border-color: var(--hg-danger);
    color: var(--hg-danger);
}

/* ---- 重定向提示卡片（消极假设引导）---- */
.hg-redirect-card {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: var(--hg-radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.hg-dark .hg-redirect-card {
    background: linear-gradient(135deg, #3a2a00, #4a3400);
    border-color: #d97706;
}

.hg-redirect-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.hg-redirect-text {
    font-size: 13px;
    color: #92400e;
    line-height: 1.6;
}

.hg-dark .hg-redirect-text {
    color: #fbbf24;
}

/* ---- 可能性仪表盘 ---- */
.hg-score-section {
    background: linear-gradient(135deg, var(--hg-surface) 55%, var(--hg-primary-light));
    border-radius: var(--hg-radius);
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid var(--hg-border);
    display: flex;
    align-items: center;
    gap: 20px;
}

.score-gauge-wrap {
    flex-shrink: 0;
    text-align: center;
    cursor: pointer;
}

.score-gauge {
    position: relative;
    width: 88px;
    height: 88px;
    transition: transform 0.2s ease;
}

.score-gauge-wrap:hover .score-gauge {
    transform: scale(1.06);
}

.score-gauge svg {
    transform: rotate(-90deg);
    width: 88px;
    height: 88px;
}

.score-gauge-bg {
    fill: none;
    stroke: var(--hg-border);
    stroke-width: 8;
}

.score-gauge-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.score-gauge-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--hg-text);
    line-height: 1;
}

.score-label {
    font-size: 10px;
    color: var(--hg-text-muted);
    margin-top: 2px;
}

.score-info {
    flex: 1;
    min-width: 0;
}

.score-summary {
    font-size: 14px;
    font-weight: 600;
    color: var(--hg-text);
    margin-bottom: 6px;
    line-height: 1.5;
}

.score-reason {
    font-size: 12px;
    color: var(--hg-text-muted);
    line-height: 1.6;
}

/* ---- 通用结果块 ---- */
.hg-result-block {
    background: var(--hg-surface);
    border-radius: var(--hg-radius);
    border: 1px solid var(--hg-border);
    margin-bottom: 12px;
    overflow: hidden;
}

.hg-result-block-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--hg-bg);
    border-bottom: 1px solid var(--hg-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--hg-text);
    cursor: pointer;
    user-select: none;
    transition: background var(--hg-transition);
}

.hg-result-block-header:hover {
    background: linear-gradient(135deg, var(--hg-primary-light), var(--hg-bg));
}

.block-toggle {
    margin-left: auto;
    font-size: 11px;
    color: var(--hg-text-muted);
    transition: transform var(--hg-transition);
}

.hg-result-block.collapsed .block-toggle {
    transform: rotate(-90deg);
}

.hg-result-block-body {
    padding: 12px 14px;
    overflow: hidden;
    max-height: 2600px;
    opacity: 1;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.28s ease,
                opacity 0.25s ease;
}

.hg-result-block.collapsed .hg-result-block-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

/* ---- 触发条件列表 ---- */
.trigger-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trigger-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 10px;
    border-radius: var(--hg-radius-sm);
    background: var(--hg-bg);
    border-left: 3px solid var(--hg-border);
}

.trigger-item.importance-必要 { border-left-color: var(--hg-danger); }
.trigger-item.importance-重要 { border-left-color: var(--hg-warning); }
.trigger-item.importance-辅助 { border-left-color: var(--hg-success); }

.trigger-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--hg-text);
    white-space: nowrap;
    margin-top: 1px;
}

.trigger-desc {
    font-size: 12px;
    color: var(--hg-text-muted);
    line-height: 1.5;
    flex: 1;
}

.trigger-badge {
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 99px;
    flex-shrink: 0;
    font-weight: 600;
    white-space: nowrap;
}

.trigger-badge.必要 { background: #fee2e2; color: #dc2626; }
.trigger-badge.重要 { background: #fef3c7; color: #d97706; }
.trigger-badge.辅助 { background: #d1fae5; color: #059669; }

.hg-dark .trigger-badge.必要 { background: #3b0a0a; color: #f87171; }
.hg-dark .trigger-badge.重要 { background: #3a2a00; color: #fbbf24; }
.hg-dark .trigger-badge.辅助 { background: #022c1a; color: #34d399; }

/* ---- 连锁效应 ---- */
.chain-levels {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chain-level {
    border-radius: var(--hg-radius-sm);
    overflow: hidden;
    border: 1px solid var(--hg-border);
}

.chain-level-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.chain-level[data-level="1"] .chain-level-header { background: #7c3aed; }
.chain-level[data-level="2"] .chain-level-header { background: #0ea5e9; }
.chain-level[data-level="3"] .chain-level-header { background: #059669; }

.chain-level-num {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255,255,255,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.chain-level-items {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: var(--hg-surface);
}

.chain-level-item {
    font-size: 12px;
    color: var(--hg-text-muted);
    line-height: 1.5;
    padding-left: 12px;
    position: relative;
    transition: color var(--hg-transition), padding-left var(--hg-transition);
}

.chain-level-item:hover {
    color: var(--hg-text);
    padding-left: 18px;
}

.chain-level-item::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--hg-primary);
    font-size: 11px;
}

/* ---- 机会矩阵 ---- */
.opportunity-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.opportunity-item {
    padding: 10px 12px;
    border-radius: var(--hg-radius-sm);
    background: var(--hg-bg);
    border: 1px solid var(--hg-border);
    transition: border-color var(--hg-transition);
}

.opportunity-item:hover {
    border-color: var(--hg-primary);
}

.opportunity-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.opportunity-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--hg-text);
    flex: 1;
}

.opp-tag {
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 99px;
    font-weight: 600;
}

.opp-tag.timeframe { background: #ede9fe; color: #7c3aed; }
.opp-tag.impact-高 { background: #d1fae5; color: #059669; }
.opp-tag.impact-中 { background: #fef3c7; color: #d97706; }
.opp-tag.impact-低 { background: #f1f5f9; color: #64748b; }

.hg-dark .opp-tag.timeframe { background: #2d1b69; color: #c4b5fd; }
.hg-dark .opp-tag.impact-高 { background: #022c1a; color: #34d399; }
.hg-dark .opp-tag.impact-中 { background: #3a2a00; color: #fbbf24; }
.hg-dark .opp-tag.impact-低 { background: #1e293b; color: #94a3b8; }

.opportunity-desc {
    font-size: 12px;
    color: var(--hg-text-muted);
    line-height: 1.5;
}

/* ---- 风险预判 ---- */
.risk-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.risk-item {
    padding: 10px 12px;
    border-radius: var(--hg-radius-sm);
    border: 1px solid var(--hg-border);
    border-left: 4px solid;
    background: var(--hg-bg);
}

.risk-item.level-高 { border-left-color: var(--hg-danger); }
.risk-item.level-中 { border-left-color: var(--hg-warning); }
.risk-item.level-低 { border-left-color: var(--hg-success); }

.risk-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.risk-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--hg-text);
    flex: 1;
}

.risk-level-badge {
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 99px;
    font-weight: 600;
}

.risk-level-badge.高 { background: #fee2e2; color: #dc2626; }
.risk-level-badge.中 { background: #fef3c7; color: #d97706; }
.risk-level-badge.低 { background: #d1fae5; color: #059669; }

.hg-dark .risk-level-badge.高 { background: #3b0a0a; color: #f87171; }
.hg-dark .risk-level-badge.中 { background: #3a2a00; color: #fbbf24; }
.hg-dark .risk-level-badge.低 { background: #022c1a; color: #34d399; }

.risk-desc {
    font-size: 12px;
    color: var(--hg-text-muted);
    line-height: 1.5;
    margin-bottom: 4px;
}

.risk-response {
    font-size: 11px;
    color: var(--hg-primary);
    font-style: italic;
}

/* ---- 关键洞见 ---- */
.insights-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.insight-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    background: linear-gradient(135deg, var(--hg-primary-light), var(--hg-bg));
    border-radius: var(--hg-radius-sm);
    border: 1px solid rgba(124,58,237,.15);
    transition: transform var(--hg-transition), box-shadow var(--hg-transition);
}

.insight-item:hover {
    transform: translateX(4px);
    box-shadow: var(--hg-shadow-sm);
}

.insight-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--hg-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.insight-text {
    font-size: 13px;
    color: var(--hg-text);
    line-height: 1.6;
}

/* ---- Toast 通知 ---- */
.hg-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: #e2e8f0;
    padding: 10px 20px;
    border-radius: 99px;
    font-size: 13px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.hg-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hg-toast.success { background: #059669; }
.hg-toast.error   { background: #dc2626; }
.hg-toast.warn    { background: #d97706; }

/* ---- 示例/模板 Modal ---- */
.hg-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.50);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.hg-modal.open {
    display: flex;
}

.hg-modal-content {
    background: var(--hg-surface);
    border-radius: var(--hg-radius);
    box-shadow: var(--hg-shadow-lg);
    width: 680px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--hg-border);
    flex-shrink: 0;
}

.hg-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--hg-text);
}

.hg-modal-close {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--hg-text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--hg-transition);
}

.hg-modal-close:hover {
    background: var(--hg-bg);
    color: var(--hg-text);
}

.hg-modal-body {
    overflow-y: auto;
    padding: 16px 18px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.hg-modal-body::-webkit-scrollbar { width: 4px; }
.hg-modal-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.template-modal-hint {
    font-size: 13px;
    color: var(--hg-text-muted);
    margin-bottom: 14px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.template-card {
    padding: 12px 14px;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius-sm);
    cursor: pointer;
    transition: all var(--hg-transition);
}

.template-card:hover {
    border-color: var(--hg-primary);
    background: var(--hg-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--hg-shadow-md);
}

.template-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--hg-text);
    margin-bottom: 4px;
}

.template-card-domain {
    font-size: 11px;
    color: var(--hg-text-light);
    margin-bottom: 4px;
}

.template-card-hypothesis {
    font-size: 11px;
    color: var(--hg-text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- 分析视角 - 差异色彩 ---- */
.hg-perspective-item input:checked + .hg-perspective-card--opt {
    border-color: #059669;
    background: #f0fdf4;
}
.hg-perspective-item input:checked + .hg-perspective-card--pess {
    border-color: #d97706;
    background: #fff7ed;
}
.hg-dark .hg-perspective-item input:checked + .hg-perspective-card--opt {
    border-color: #34d399;
    background: #022c1a;
}
.hg-dark .hg-perspective-item input:checked + .hg-perspective-card--pess {
    border-color: #fbbf24;
    background: #3a2a00;
}

/* ---- section 标题分隔线（配置区块分层规范）---- */
.hg-section-label {
    display: block;
    border-bottom: 1px solid #e0f2fe;
    padding-bottom: 6px;
    margin-bottom: 8px;
}
.hg-dark .hg-section-label {
    border-bottom-color: #1e3a5f;
}

/* ---- 入场动画 ---- */
@keyframes hgSlideIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hg-anim-in {
    animation: hgSlideIn 0.38s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ---- 快捷键提示样式 ---- */
.shortcut-hint {
    font-size: 0.8em;
    color: var(--hg-text-light);
    font-family: monospace;
    opacity: 0.7;
    display: inline-block;
    transition: opacity var(--hg-transition), transform var(--hg-transition);
}
.shortcut-hint:hover {
    opacity: 1;
    transform: scale(1.05);
}

/* ---- 响应式 ---- */
@media (max-width: 900px) {
    .hg-main-content {
        grid-template-columns: 1fr;
    }
    .hg-history-panel {
        border-right: none;
        border-bottom: 1px solid var(--hg-border);
        max-height: 200px;
    }
    .hg-editor-panel {
        border-right: none;
        border-bottom: 1px solid var(--hg-border);
    }
    .hg-form-row {
        grid-template-columns: 1fr;
    }
    .hg-depth-selector,
    .hg-perspective-selector {
        grid-template-columns: 1fr;
    }
    .template-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hg-toolbar {
        gap: 2px;
        padding: 0 8px;
    }
    .hg-toolbar-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
}

@media (max-width: 640px) {
    .shortcut-hint { display: none; }
    .hg-form-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .hg-btn--primary {
        width: 100%;
        justify-content: center;
    }
}
