/*
 * 人生轨迹故事 (Life Story) 样式表
 * 设计语言与站点一致：深色主题、渐变强调色
 * 山丘人生图：曲线下方渐变填充，凸显人生起伏
 */

/* 页面主体 */
body {
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.page-header {
    text-align: center;
    padding: 3rem 1rem 1rem;
    max-width: 900px;
    margin: 0 auto;
}

.page-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 640px;
    margin: 0 auto;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1rem 3rem;
}

/* 主体两栏布局 */
.life-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.life-left {
    flex: 1.6;
    min-width: 0;
}

.life-right {
    flex: 1;
    min-width: 320px;
}

/* 图表卡片 */
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chart-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.chart-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.legend-dot.high { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,.8); }
.legend-dot.mid  { background: #00d4ff; box-shadow: 0 0 6px rgba(0,212,255,.8); }
.legend-dot.low  { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.8); }

/* 画布 */
.chart-wrap {
    position: relative;
    width: 100%;
}

.chart-wrap canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    cursor: crosshair;
    background: linear-gradient(180deg, #0d1524 0%, #111c30 100%);
    touch-action: none;
}

.chart-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 0.75rem;
}

/* 事件信息卡（点击节点弹出） */
.event-pop {
    margin-top: 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: none;
}

.event-pop.show { display: block; }

.event-pop .ep-title {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.event-pop .ep-score {
    font-size: 0.9rem;
    padding: 2px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.event-pop .ep-score.high { background: rgba(16,185,129,0.15); color: #34d399; }
.event-pop .ep-score.mid  { background: rgba(0,212,255,0.15); color: #00d4ff; }
.event-pop .ep-score.low  { background: rgba(239,68,68,0.15); color: #f87171; }

.event-pop .ep-age { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.event-pop .ep-content { font-size: 0.92rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 0.75rem; white-space: pre-wrap; }

.event-pop .ep-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 控制区 */
.controls-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.controls-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(0,212,255,0.35); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.btn-secondary:hover { background: rgba(255,255,255,0.14); box-shadow: none; }

.btn-danger {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.35);
    color: #f87171;
}

.btn-danger:hover { background: rgba(239,68,68,0.25); box-shadow: none; }

.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }

/* 事件列表 */
.event-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 380px;
    overflow-y: auto;
}

.event-item {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.event-item:hover { border-color: var(--accent); }

.event-item .ei-badge {
    flex: 0 0 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    color: #fff;
}

.event-item .ei-badge.high { background: linear-gradient(135deg, #059669, #10b981); }
.event-item .ei-badge.mid  { background: linear-gradient(135deg, #0e7490, #00d4ff); }
.event-item .ei-badge.low  { background: linear-gradient(135deg, #b91c1c, #ef4444); }

.event-item .ei-main { flex: 1; min-width: 0; }
.event-item .ei-title {
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-item .ei-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.event-item .ei-del {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.event-item .ei-del:hover { color: #f87171; background: rgba(239,68,68,0.12); }

.empty-tip {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 1.5rem 0;
}

/* 模态弹窗 */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 1rem;
}

.modal-mask.show { display: flex; }

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 1.5rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.modal-box h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

.form-field { margin-bottom: 1rem; }

.form-field label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="password"],
.form-field textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.92rem;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-field input:focus,
.form-field textarea:focus { border-color: var(--accent); }

.form-field textarea { min-height: 90px; resize: vertical; line-height: 1.6; }

.form-row { display: flex; gap: 0.75rem; }
.form-row .form-field { flex: 1; }

/* 评分滑块 */
.score-slider-wrap { display: flex; align-items: center; gap: 0.8rem; }

.score-slider-wrap input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
    cursor: pointer;
}

.score-value {
    flex: 0 0 52px;
    text-align: center;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 4px 0;
    border-radius: 8px;
    color: #fff;
}

.score-value.high { background: #10b981; }
.score-value.mid  { background: #0891b2; }
.score-value.low  { background: #ef4444; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.2rem;
}

/* 故事广场 */
.plaza-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.plaza-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.plaza-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* 登录区 */
.auth-box {
    background: rgba(255,255,255,0.03);
    border: 1px dashed var(--border-light);
    border-radius: 12px;
    padding: 1.2rem;
}

.auth-box .form-row { margin-bottom: 0; }

.auth-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    line-height: 1.6;
}

.auth-status .user-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    background: rgba(0,212,255,0.12);
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 6px;
}

/* 他人故事列表 */
.story-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-top: 0.8rem;
    max-height: 420px;
    overflow-y: auto;
}

.story-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.story-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.story-card .sc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.story-card .sc-author { font-weight: 700; font-size: 0.95rem; }

.story-card .sc-meta { font-size: 0.78rem; color: var(--text-muted); }

.story-card .sc-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-card .sc-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 22px;
    font-size: 0.9rem;
    color: var(--text-primary);
    box-shadow: 0 10px 40px rgba(0,0,0,.6);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 600;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Lang menu dropdown */
.lang-menu{
    display:none;position:fixed;top:70px;right:20px;
    background:var(--bg-card);border:1px solid var(--border);
    border-radius:10px;padding:8px 0;z-index:200;
    box-shadow:0 4px 20px rgba(0,0,0,.5);
}
.lang-menu a{
    display:block;padding:8px 20px;color:var(--text-secondary);
    text-decoration:none;font-size:.9rem;cursor:pointer;
    transition:background .2s;
}
.lang-menu a:hover{background:rgba(255,255,255,.05);color:var(--text-primary)}

/* 响应式 */
@media (max-width: 960px) {
    .life-layout { flex-direction: column; }
    .life-right { width: 100%; min-width: 0; }
    .page-header h1 { font-size: 1.7rem; }
}

@media (max-width: 768px) {
    .nav-menu{
        display:none;flex-direction:column;position:absolute;top:64px;left:0;right:0;
        width:100%;background:#0d1321;padding:1rem 1.5rem;
        border-bottom:1px solid var(--border);gap:1rem;
    }
    .nav-menu.open{display:flex}
    .nav-toggle{display:block}
}

@media (max-width: 600px) {
    .main-container { padding: 0.5rem 0.75rem 2rem; }
    .chart-card, .controls-card, .plaza-card { padding: 1rem; }
    .chart-header { flex-direction: column; align-items: flex-start; }
}
