/* ============================================================
   全站共用样式（首页 index.html + 待办子页 todo.html）
   ============================================================ */

/* ---------- 颜色变量：改这里就能换主题色 ---------- */
:root {
    --primary: #5d74db;
    --primary-dark: #5568d3;
    --text: #2d3436;
    --muted: #7f8c8d;
    --radius: 16px;
    --bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ---------- 基础重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth; /* 点击锚点链接时平滑滚动 */
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    background: var(--bg) fixed;
    min-height: 100vh;
    color: var(--text);
}

/* ============================================================
   顶部导航（两个页面共用）
   ============================================================ */
.nav {
    position: sticky;              /* 滚动时吸在顶部 */
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);   /* 毛玻璃效果 */
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.nav-logo {
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a,
.nav-back {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-back:hover {
    color: #fff;
}

/* ============================================================
   通用按钮
   ============================================================ */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 999px;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-primary {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* ============================================================
   首页：首屏 Hero
   ============================================================ */
.hero {
    text-align: center;
    padding: 100px 24px 80px;
    color: #fff;
}

.avatar {
    width: 110px;
    height: 110px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    font-weight: 700;
    border-radius: 50%;
    overflow: hidden;            /* 关键：把超出圆形的图片裁掉 */
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* 头像图片：填满整个圆形区域，并保持比例不拉伸 */
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;           /* 保持比例铺满，多余部分裁掉 */
    display: block;
    border-radius: 50%;          /* 双重保险：图片自身也裁成圆 */
}

.hero h1 {
    font-size: 40px;
    margin-bottom: 16px;
}

.highlight {
    color: #ffe08a;
}

.hero-sub {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 32px;
}

.hero-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* ============================================================
   首页：通用区块
   ============================================================ */
.section {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 24px;
}

.section-title {
    color: #fff;
    font-size: 26px;
    text-align: center;
    margin-bottom: 36px;
}

/* 技能标签 */
.skills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.skill-tag {
    padding: 10px 20px;
    border-radius: 999px;
    color: #fff;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: background 0.2s, transform 0.2s;
}

.skill-tag:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* 作品卡片网格 */
.projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.project-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    transition: transform 0.25s;
}

.project-card:hover {
    transform: translateY(-6px);
}

.project-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.project-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.project-card p {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* 卡片里的按钮换成主题色 */
.project-card .btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: none;
}

.project-card .btn-primary:hover {
    background: var(--primary-dark);
}

.project-card--soon {
    opacity: 0.75;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 999px;
    background: #f1f2f6;
    color: var(--muted);
    font-size: 14px;
}

/* 关于我：底部空白卡片（以后显示 Aboutme.txt 的内容） */
.about-card {
    max-width: 720px;
    margin: 0 auto;
    min-height: 160px;
    padding: 28px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    color: var(--text);
    line-height: 1.8;
    white-space: pre-wrap;   /* 保留 txt 中的换行 */
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    padding: 30px 20px 40px;
}

/* ============================================================
   待办子页
   ============================================================ */
.todo-page {
    display: flex;
    flex-direction: column;
}

.center-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.container {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    padding: 32px 28px;
}

.container h1 {
    text-align: center;
    color: #333;
    font-size: 26px;
    margin-bottom: 24px;
}

.input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

#todo-input {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

#todo-input:focus {
    border-color: var(--primary);
}

#add-btn {
    padding: 12px 22px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

#add-btn:hover {
    background: var(--primary-dark);
}

#todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f7f8fc;
    border-radius: 8px;
}

.todo-item span {
    flex: 1;
    font-size: 16px;
    color: #333;
    word-break: break-all;
}

.todo-item.done span {
    text-decoration: line-through;
    color: #aaa;
}

.delete-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.delete-btn:hover {
    color: #e03131;
}

.empty-tip {
    text-align: center;
    color: #bbb;
    font-size: 14px;
    padding: 20px 0;
}

/* ============================================================
   响应式：屏幕宽度小于 600px 时调整（手机）
   ============================================================ */
@media (max-width: 600px) {
    .nav {
        padding: 14px 18px;
    }

    .nav-links {
        gap: 16px;
    }

    .hero {
        padding: 70px 20px 50px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero-sub {
        font-size: 16px;
    }

    .section {
        padding: 40px 18px;
    }
}

/* ============================================================
   卜卦页（gua.html）
   ============================================================ */
.gua-main {
    max-width: 560px;
    margin: 0 auto;
    padding: 48px 24px 80px;
    text-align: center;
    color: #fff;
}

.gua-title {
    font-size: 32px;
    margin-bottom: 12px;
}

.gua-hint {
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    margin-bottom: 28px;
    min-height: 22px;
}

/* 六爻展示区：column-reverse 让第一条爻显示在最下面 */
.hexagram {
    display: flex;
    flex-direction: column-reverse;  /* 主方向反转：第一个子元素在底部 */
    justify-content: flex-start;
    gap: 8px;
    min-height: 240px;
    padding: 22px 16px;
    margin-bottom: 22px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
}

/* 每一爻：左序号 / 中爻象 / 右类型 */
.yao-row {
    display: grid;
    grid-template-columns: 40px 1fr 48px;
    align-items: center;
    gap: 10px;
    animation: yao-in 0.3s ease-out;
}

@keyframes yao-in {
    from { opacity: 0; transform: scaleX(0.4); }
    to   { opacity: 1; transform: scaleX(1); }
}

.yao-index {
    text-align: right;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.yao {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 26px;
}

.yao-bar {
    display: block;
    height: 12px;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* 阳爻：一根长条 */
.yao-yang .yao-bar {
    width: 180px;
}

/* 阴爻：两根短条 */
.yao-yin .yao-bar {
    width: 84px;
}

/* 动爻（老阳/老阴）高亮 */
.yao-changing .yao-bar {
    background: #ffe08a;
    box-shadow: 0 0 14px rgba(255, 224, 138, 0.85);
}

.yao-label {
    text-align: left;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

/* ===== 硬币 ===== */
.coins {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 14px;
}

.coin {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #7a5a12;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffe9a8, #f7c948);
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.coin.flipping {
    animation: coin-flip 0.65s ease-in-out;
}

@keyframes coin-flip {
    0%   { transform: rotateY(0); }
    50%  { transform: rotateY(540deg) scale(1.12); }
    100% { transform: rotateY(1080deg); }
}

.gua-last {
    min-height: 22px;
    margin-bottom: 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

/* ===== 操作按钮 ===== */
.gua-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

#cast-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== 结算区 ===== */
.gua-result {
    margin-top: 32px;
    padding: 28px 24px;
    text-align: center;
    background: #fff;
    color: var(--text);
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    animation: result-in 0.4s ease-out;
}

@keyframes result-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 本卦 / 动爻 / 变卦 之间的分隔 */
.result-block + .result-block {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px dashed #e5e7eb;
}

.result-label {
    font-size: 13px;
    letter-spacing: 3px;
    color: var(--muted);
    margin-bottom: 6px;
}

/* 卦名：结算时最先、最醒目 */
.result-name {
    font-size: 30px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
    margin-bottom: 16px;
}

.result-name--bian {
    color: #764ba2;
}

.result-trigrams {
    display: flex;
    justify-content: center;
    gap: 48px;
}

.trigram-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.trigram-caption {
    font-size: 13px;
    color: var(--muted);
}

.trigram-symbol {
    font-size: 36px;
    line-height: 1.1;
    color: var(--text);
}

.trigram-name {
    font-size: 15px;
    font-weight: 600;
}

/* 动爻 */
.dong-list {
    font-size: 16px;
    font-weight: 600;
    color: #b45309;
    line-height: 1.7;
}

/* 传统取用建议 */
.reading-block {
    text-align: center;
}

.reading-rule {
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.6;
    color: #b45309;
}

.reading-texts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.reading-item {
    padding: 12px 14px;
    border-radius: 10px;
    background: #f7f8fc;
    border-left: 4px solid #d1d5db;
}

.reading-item--primary {
    background: #fff7e6;
    border-left-color: #f59e0b;
}

.reading-item--secondary {
    background: #f1f5ff;
    border-left-color: #93a7f5;
}

.reading-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.reading-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: #9ca3af;
}

.reading-item--primary .reading-badge {
    background: #f59e0b;
}

.reading-item--secondary .reading-badge {
    background: #93a7f5;
}

.reading-source {
    font-size: 12px;
    color: var(--muted);
}

.reading-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
}

.reading-note {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--muted);
}

/* 下载结果图 */
.gua-share {
    margin-top: 24px;
    text-align: center;
}

#share-btn {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.35);
}

#share-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(102, 126, 234, 0.45);
}

#share-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

/* 卦辞折叠区 */
.gua-text {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px dashed #e5e7eb;
    text-align: left;
}

.gua-text summary {
    list-style: none;
    cursor: pointer;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    user-select: none;
}

.gua-text summary::-webkit-details-marker {
    display: none;
}

.gua-text summary::after {
    content: ' ▾';
    font-size: 12px;
}

.gua-text[open] summary::after {
    content: ' ▴';
}

.gua-text-body {
    margin-top: 14px;
    padding: 18px;
    background: #f7f8fc;
    border-radius: 10px;
}

.gua-text-name {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.gua-ci {
    font-size: 16px;
    line-height: 2;
    color: var(--text);
}

/* 六爻爻辞 */
.yao-ci-title {
    margin-top: 18px;
    margin-bottom: 8px;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--muted);
}

.yao-ci-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.yao-ci-item {
    padding: 8px 12px;
    border-radius: 8px;
    background: #fff;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
}

.yao-ci-item--changing {
    background: #fff7e6;
    border-left: 3px solid #f59e0b;
    font-weight: 600;
    color: #92400e;
}

/* 六爻数值附注 */
.gua-summary {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px dashed #e5e7eb;
    font-family: Consolas, monospace;
    font-size: 14px;
    color: var(--muted);
}

/* ===== 卜卦页响应式 ===== */
@media (max-width: 600px) {
    .gua-main {
        padding: 36px 16px 60px;
    }

    .gua-title {
        font-size: 26px;
    }

    .yao-yang .yao-bar {
        width: 140px;
    }

    .yao-yin .yao-bar {
        width: 64px;
    }
}