body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
}

.aspect-ratio-box {
    width: 480px;
    height: 854px;
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: 16 / 9;
    background-image: url('beijingip.png');
    background-size: cover;
    background-position: center;
    margin: 0 auto; /* 居中显示 */
}

.form-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.form-group{
    margin-top: 30px; /* 在九宫格上方留出空间 */
    margin-left: -40px;
}

.qimen-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qimen-header {
    margin-top: 50px; /* 在九宫格上方留出空间 */
    margin-left: 100px;
    text-align: left;/* 改为左对齐 */
    width: 100%; /* 让容器占满宽度 */
    margin-bottom: 70px;/* 在九宫格上方留出空间 */
}  

.header-row {
    margin-bottom: 5px;
}


.row-container-sizhuz {
    display: flex;
    align-items: center; /* 垂直居中对齐 */
    gap: 1px; /* header-row 与 四柱之间的间距 */
}

.header-row-sizhuz {
    display: flex;
    flex-direction: column; /* 将 Year-Month-Day, Heavenly Stems 和 Xun Shou 垂直排列 */
    line-height: 1.5; /* 行高 */
    margin-right: 10px; /* 与四柱之间的额外间距 */
}

/* 干支四柱 */
.sizhuz-container {
    display: flex;
    gap: 10px; /* 每柱之间的间距 */
}

.sizhuz-pillar {
    writing-mode: vertical-rl; /* 使文字竖向排列，从右到左 */
    text-orientation: upright; /* 保持每个字符正向显示 */    
    text-align: center; /* 居中对齐 */
    font-size: 14px;
}
/* 干支四柱end */

/* 旬首 */
.header-row-xun {
    display: flex;
    justify-content: space-between; /* 列之间自动分配剩余空间 */
    gap: 10px; /* 列之间的间隔 */
    transform: translateX(1%);
    width: 60%; /* 容器宽度，可以根据需要调整 */
}

.xun-column {
    display: flex;
    flex: 1; /* 每个列均分宽度 */
    text-align: center;
    align-items: flex-end;;
}
/* 旬首end */

/* ju type 阳遁 or 阴遁 */
.ju-type {
    position: absolute;
    top: 2%;
    left: 39%;
}

.qimen-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background-color: #000;
    padding: 1px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    position: relative;
    margin-top: 15px;
}

.grid-cell {
    background-color: #fff;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    
}

.hidden-gan {
    position: absolute;
    font-size: 14px;
    z-index: 2;
}

.top-gan {
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
}

.bottom-gan {
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
}

.left-gan {
    left: -35px;
    top: 50%;
    transform: translateY(-50%);
}

.right-gan {
    right: -35px;
    top: 50%;
    transform: translateY(-50%);
}

.top-left-gan {
    top: -35px;
    left: -35px;
}

.top-right-gan {
    top: -35px;
    right: -35px;
}

.bottom-left-gan {
    bottom: -35px;
    left: -35px;
}

.bottom-right-gan {
    bottom: -35px;
    right: -35px;
}

/* 空亡位置调整 */
.kongwang {
    position: absolute;
    z-index: 9999; /* 一个很大的数值，确保在所有元素之上 */
    width: 13px;  /* 圈的大小 */
    height: 13px; /* 圈的大小 */
    border: 1px solid #000; /* 圈的颜色和宽度 */
    border-radius: 50%; /* 使其成为圆形 */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    color: #000;
}

.kw-qian[data-position="bottom-right"] {
    top: 294%;
    right: -220%;
    transform: translateX(-50%);
}

.kw-dui-kun[data-position="right"]  {
    top: 100%;
    right: -213%;
    transform: translateY(-50%);
}

.kw-kun-li[data-position="top-right"] {
    top: -10%;
    right: -121%;
    transform: translateX(-50%);
}

.kw-xun[data-position="top"] {
    top: -10%;
    left: 0%;
    transform: translateX(-50%);
}

.kw-zhen-gen[data-position="bottom-left"] {
    top: 201%;
    right: 92%;
    transform: translateY(-50%);
}

.kw-gen-kan[data-position="bottom"] {
    top: 293%;
    right: -19%;
    transform: translateX(-50%);
}

/* 马星位置调整 */
.maxin {
    display: flex;
    align-items: center;
    position: absolute;
    font-size: 14px;
    font-weight: bold;
    /* color: #ff6347; */
}
.m-xun[data-position="top-left"] {
    bottom: 140%;
    left: -65%;
    transform: translateX(-50%);
}

.m-gen[data-position="bottom-left"] {
    bottom: -268%;
    left: -65%;
    transform: translateX(-50%);
}

.m-qian[data-position="bottom-right"] {
    bottom: -268%;
    left: 368%;
    transform: translateX(-50%);
}

.m-kun[data-position="top-right"] {
    bottom: 140%;
    left: 368%;
    transform: translateX(-50%);
}

.content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    width: 30%;
}

.center {
    width: 40%;
    text-align: center;
}

.right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    width: 30%;
}

.shen, .tian, .di, .xing, .men {
    position: absolute;
    font-size: 14px;
}

.shen {
    font-size: 14px;
    left: 5px; /* 距离左边10px */
    /* color: #ff6347; */
}

.tian {
    margin-top: 25px; /* 向下移动 35px */
    left: 5px; /* 距离左边10px */
    /* color: #4682b4; */
}

.di {
    margin-top: 50px; /* 向下移动 65px */
    left: 5px; /* 距离左边10px */
    /* color: #3cb371; */
}

.xing {
    font-size: 14px;
    margin-top: 20px; /* 向下移动 20px */
    position: relative; /* 或 relative，根据实际需求 */
    right: 1px; /* 距离右边10px */
    /* color: #8a2be2; */
}

.men {
    font-size: 14px;
    /* font-weight: bold; */
    position: relative; /* 或 relative，根据实际需求 */
    right: 1px; /* 距离右边10px */
}

.men-po {
    color: #ff6347;
}

.qiankun {
    position: absolute;
    bottom: 47%; /* 可以根据需要调整位置 */
    right: 47%; /* 可以根据需要调整位置 */
    width: 5px;
    height: 5px;
    background-color: #000; /* 圆圈的颜色 */
    border-radius: 50%; /* 使元素变为圆形 */
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.red-text {
    color: #ff6347;
  }

  /* 入墓 */
.circle-container {
    z-index: 9999; /* 一个很大的数值，确保在所有元素之上 */
    width: 20px;  /* 圈的大小 */
    height: 20px; /* 圈的大小 */
    border: 1px solid #484848; /* 圈的颜色和宽度 */
    border-radius: 20%; /* 使其成为圆形 */
    /* display: flex; */
    align-items: center;
    justify-content: center;
    align-items: center;
  }

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .aspect-ratio-box {
        width: 100%;
        height: auto;
        min-height: 100vh;
    }

    .qimen-grid {
        grid-template-columns: repeat(3, minmax(60px, 80px));
        grid-template-rows: repeat(3, minmax(60px, 80px));
    }

    .qimen-header {
        margin-left: 30px;
        margin-top: 30px;
        margin-bottom: 40px;
        padding-left: 75px;
    }

    .hidden-gan {
        font-size: 12px;
    }

    .shen, .xing, .men {
        font-size: 14px;
    }

    .tian, .di {
        font-size: 14px;
    }

    /* 调整空亡位置 */
    .kongwang {
        width: 12px;
        height: 12px;
        font-size: 10px;
    }

    /* 调整马星位置 */
    .maxin {
        font-size: 12px;
    }

    /* 调整四柱字体 */
    .sizhuz-pillar {
        font-size: 14px;
    }

    /* 调整角干位置 */
    .top-left-gan {
        top: -25px;    
        left: -25px;   
    }

    .top-right-gan {
        top: -25px;    
        right: -25px;  
    }

    .bottom-left-gan {
        bottom: -25px; 
        left: -25px;   
    }

    .bottom-right-gan {
        bottom: -25px; 
        right: -25px;  
    }

    .grid-cell {
        padding: 0px;
    }
}

/* 更小屏幕的适配 */
@media screen and (max-width: 430px) {
    .qimen-grid {
        grid-template-columns: repeat(3, minmax(50px, 70px));
        grid-template-rows: repeat(3, minmax(50px, 70px));
    }

    .hidden-gan {
        font-size: 12px;
    }

    /* 调整干支位置 */
    .top-gan { top: -20px; }
    .bottom-gan { bottom: -20px; }
    .left-gan { left: -20px; }
    .right-gan { right: -20px; }
    
    /* 调整角干位置 */
    .top-left-gan { top: -20px; left: -20px; }
    .top-right-gan { top: -20px; right: -20px; }
    .bottom-left-gan { bottom: -20px; left: -20px; }
    .bottom-right-gan { bottom: -20px; right: -20px; }


    .grid-cell {
        padding: 0px;
    }
}

input[type="datetime-local"] {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    width: auto;
    margin-right: 10px;
    background-color: #fff;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

input[type="datetime-local"]:hover {
    border-color: #aaa;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

input[type="datetime-local"]:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* 适配深色模式 */
@media (prefers-color-scheme: dark) {
    input[type="datetime-local"] {
        background-color: #f5f5f5;
        color: #333;
        border-color: #ddd;
    }
    
    input[type="datetime-local"]:hover {
        background-color: #fff;
    }
}

  