/* ============================================================
 * 大逗校园 · AI新生人设生成 - 页面样式
 * ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --brand: #667EEA;
    --brand-dark: #5568C9;
    --text: #1F2937;
    --text-light: #6B7280;
    --bg: #F3F4F8;
    --radius: 16px;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

/* ============ 顶部导航 ============ */
.persona-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #EEF0F4;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 16px;
}
.back-link {
    font-size: 15px;
    color: var(--brand);
    text-decoration: none;
    width: 70px;
}
.header-title {
    font-size: 17px;
    font-weight: 600;
}
.header-right { width: 70px; }

/* ============ 主容器 ============ */
.persona-main {
    padding: 16px 16px 40px;
}

/* ============ 步骤标题 ============ */
.step-section { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.step-head { margin-bottom: 18px; }
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    background: linear-gradient(135deg, var(--brand), #764BA2);
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    margin-right: 8px;
    vertical-align: middle;
}
.step-head h2 { display: inline; font-size: 20px; font-weight: 700; vertical-align: middle; }
.step-sub { color: var(--text-light); font-size: 13px; margin-top: 8px; padding-left: 34px; }

/* ============ 学科大类网格 ============ */
.major-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}
.major-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(31,41,55,0.06);
    transition: all .2s ease;
    user-select: none;
}
.major-card:active { transform: scale(0.96); }
.major-card .major-icon {
    width: 44px; height: 44px;
    margin: 0 auto 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}
.major-card .major-name { font-size: 13px; font-weight: 600; line-height: 1.35; }
.major-card .major-majors { font-size: 10px; color: var(--text-light); margin-top: 4px; line-height: 1.4; }
.major-card.selected {
    border-color: var(--brand);
    box-shadow: 0 4px 16px rgba(102,126,234,0.25);
    transform: translateY(-2px);
}
.major-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px; right: 8px;
    width: 18px; height: 18px;
    background: var(--brand);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.major-card { position: relative; }

/* ============ 兴趣标签 ============ */
.tags-wrap { background: #fff; border-radius: var(--radius); padding: 18px 14px; box-shadow: 0 2px 8px rgba(31,41,55,0.06); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-item {
    padding: 9px 16px;
    background: #F3F4F8;
    border-radius: 24px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .15s ease;
    user-select: none;
}
.tag-item:active { transform: scale(0.94); }
.tag-item.selected {
    background: rgba(102,126,234,0.12);
    border-color: var(--brand);
    color: var(--brand-dark);
    font-weight: 600;
}

/* ============ 自定义输入 ============ */
.custom-wrap { position: relative; }
.custom-textarea {
    width: 100%;
    min-height: 120px;
    border: 1.5px solid #E5E7EB;
    border-radius: var(--radius);
    padding: 14px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    background: #fff;
    outline: none;
    transition: border-color .2s;
}
.custom-textarea:focus { border-color: var(--brand); }
.char-count { text-align: right; color: var(--text-light); font-size: 12px; margin-top: 6px; }

/* ============ 按钮 ============ */
.step-nav { display: flex; gap: 12px; margin-top: 24px; }
.step-nav .btn { flex: 1; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 13px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .2s ease;
    font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(135deg, var(--brand), #764BA2);
    color: #fff;
    box-shadow: 0 4px 14px rgba(102,126,234,0.35);
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: #fff; color: var(--text); border: 1.5px solid #E5E7EB; }
.btn-outline { background: transparent; color: var(--text-light); border: 1.5px solid #E5E7EB; }

/* ============ AI 加载动画 ============ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.97);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}
.loading-box { text-align: center; padding: 0 32px; }
.ai-orb { position: relative; width: 120px; height: 120px; margin: 0 auto 28px; }
.orb-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}
.ring1 {
    border-top-color: var(--brand);
    border-right-color: var(--brand);
    animation: spin 1.2s linear infinite;
}
.ring2 {
    inset: 14px;
    border-bottom-color: #764BA2;
    border-left-color: #764BA2;
    animation: spin 1.6s linear infinite reverse;
}
.orb-core {
    position: absolute;
    inset: 30px;
    background: linear-gradient(135deg, var(--brand), #764BA2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 6px 24px rgba(102,126,234,0.4);
    animation: pulse 1.6s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.loading-title { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.loading-tips { color: var(--text-light); font-size: 13px; line-height: 1.7; min-height: 44px; }

/* ============ 结果卡片（3:4 竖版） ============ */
.result-section { animation: fadeIn .5s ease; }
.result-head { text-align: center; margin-bottom: 18px; }
.result-head h2 { font-size: 19px; font-weight: 700; }
.result-sub { color: var(--text-light); font-size: 12px; margin-top: 6px; }

.card-stage { display: flex; justify-content: center; padding: 6px 0 10px; }

/* 人设卡片本体 —— 3:4 竖版 */
.persona-card {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 3 / 4;
    border-radius: 22px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 12px 40px rgba(31,41,55,0.25);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 卡片内容面板（叠加在背景图上） */
.card-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 22px;
}

/* 顶部：校徽 + 大类标签 */
.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-school {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgba(0,0,0,0.35);
    padding: 5px 12px;
    border-radius: 20px;
    letter-spacing: 1px;
}
.card-major-tag {
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: rgba(255,255,255,0.25);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.4);
}

/* 中部信息区：半透明面板 */
.card-panel {
    margin-top: auto;
    background: rgba(255,255,255,0.94);
    border-radius: 18px;
    padding: 20px 18px;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    width: 100%;
}

/* 人设名称 */
.persona-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.persona-name {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #4F46E5, #9333EA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.persona-name-badge {
    font-size: 10px;
    color: #fff;
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
    flex-shrink: 0;
}

/* 能力标签 */
.ability-list { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.ability-tag {
    font-size: 11px;
    font-weight: 600;
    color: #4F46E5;
    background: rgba(79,70,229,0.09);
    border: 1px solid rgba(79,70,229,0.22);
    padding: 4px 10px;
    border-radius: 14px;
}

/* 个人特质 */
.traits-block { margin-bottom: 14px; }
.traits-label, .slogan-label, .clubs-label {
    font-size: 11px;
    font-weight: 700;
    color: #9CA3AF;
    letter-spacing: 2px;
    margin-bottom: 5px;
}
.traits-text { font-size: 13.5px; line-height: 1.65; color: #374151; }

/* 成长宣言 */
.slogan-block {
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(167,139,250,0.12));
    border-left: 3px solid #667EEA;
    border-radius: 0 10px 10px 0;
    padding: 10px 12px;
    margin-bottom: 14px;
}
.slogan-text { font-size: 14px; font-weight: 700; color: #4338CA; line-height: 1.5; }

/* 社团推荐 */
.clubs-list { display: flex; flex-wrap: wrap; gap: 7px; }
.club-tag {
    font-size: 11px;
    color: #374151;
    background: #F3F4F8;
    border-radius: 14px;
    padding: 4px 10px;
    border: 1px solid #E5E7EB;
}

/* 卡片底部水印 */
.card-footer {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9px;
    color: rgba(255,255,255,0.75);
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* ============ 结果操作按钮 ============ */
.result-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.result-actions .btn { flex: 1; min-width: 100px; }

/* ============ 底部 ============ */
.persona-footer { text-align: center; color: #9CA3AF; font-size: 11px; padding: 20px 0 28px; }

/* ============ Toast ============ */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(17,24,39,0.9);
    color: #fff;
    padding: 10px 22px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: all .3s ease;
    white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 响应式微调 ============ */
@media (max-width: 380px) {
    .major-grid { grid-template-columns: 1fr 1fr; }
    .major-card .major-majors { display: none; }
}
