* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 确保body和html可以滚动 */
body {
    font-family: 'Microsoft YaHei', 'SimSun', serif;
    background: linear-gradient(135deg, #f5f1e6, #e8dfc7);
    min-height: auto; /* 关键修改：允许内容自然扩展 */
    height: auto; /* 添加：允许内容自然扩展 */
    display: block; /* 修改：移除flex限制 */
    align-items: stretch; /* 修改：允许内容填充 */
    padding: 20px;
    color: #5d4037;
    overflow-x: hidden;
    overflow-y: auto; /* 确保垂直滚动 */
    touch-action: auto; /* 允许触摸滚动 */
}

/* 确保地图容器不会阻止滚动 */
.map-container {
    position: relative;
    min-height: 700px;
    border: 1px solid #d4bf8a;
    border-radius: 10px;
    overflow: hidden;
    background: #f8f4e1;
    margin-bottom: 20px;
    margin-top: 20px;
    margin-right: 20px;
    flex: 1;
    touch-action: auto; /* 允许触摸滚动 */
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    width: 100%;
    max-width: 1400px;
    /* border-bottom: 2px solid #d4b886; */
}

h1 {
    font-size: 2.5rem;
    color: #5d4037;
    margin-bottom: 5px;
    text-shadow: 1px 1px 2px rgba(93, 64, 55, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    color: #7d5d47;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.5;
}

.main-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

#showShadow {
    width: 100%;
    min-height: 700px;
    position: relative;
    flex: 1;
    display: flex;
    border: 0px solid #d4bf8a;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
    margin-top: 20px;
}

#yin {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2000;
}

#yin2 {
    position: absolute;
    bottom: 20px;
    right: 30px;
    z-index: 2000;
}

#showContainer {
    width: 100%;
    min-height: 700px;
    position: relative;
    flex: 1;
    flex-direction: row;
    display: flex;
    border: 1px solid #d4bf8a;
    border-radius: 10px;
    background: #e9d6ab;
}

#starsContainer {
    width: 350px;
    min-height: 700px;
    position: relative;
    margin-bottom: 20px;
    margin-top: 20px;
    margin-right: 20px;
    margin-left: 20px;
    background: #f8f4e1;
    border: 1px solid #d4bf8a;
    border-radius: 10px;
    padding: 20px;
    z-index: 1200;
}

.map-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
    flex-shrink: 0;
}

.map-controls button {
    width: auto;
    padding: 12px 30px;
    margin-top: 0;
}

#mapCanvas {
    width: 100%;
    height: 100%;
    cursor: default;
}

.compass-container {
    position: absolute;
    width: 600px;
    height: 600px;
    cursor: grab;
    touch-action: none; /* 修改这里：允许垂直和水平滚动 */
    transition: transform 0.3s ease-out;
    z-index: 10;
}

#compass {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 
        0 0 25px rgba(120, 86, 63, 0.4),
        inset 0 0 60px rgba(0, 0, 0, 0.1);
    background: rgba(237, 225, 197, 0.7);
    cursor: grab;
    touch-action: none; /* 修改这里：允许垂直和水平滚动 */
    transition: transform 0.3s ease-out;
}

.indicator {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.direction-marker {
    position: absolute;
    top: 0;
    left: calc(50% - 1px);
    width: 2px;
    height: 100%;
    /* background: linear-gradient(to bottom, #d32f2f 0%, #d32f2f 20%, transparent 20%, transparent 60%, #d32f2f 60%, #d32f2f 100%); */
    background: #d32f2f;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    z-index: 100;
}

.point {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #d32f2f !important;
    border: 1px solid #fff;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    z-index: 101;
}

.arrow-marker::before {
    content: '';
    position: absolute;
    bottom: 0px;  /* 将箭头定位在尾部 */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 10px solid #d32f2f;
    z-index: 102;
}

.control-panel {
    background: #e9d6ab;
    border-radius: 15px;
    padding: 25px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #d4bf8a;
    margin-bottom: 30px;
}

.control-group {
    display: flex;
    flex-direction: row;
    margin-bottom: 20px;
    padding: 10px;
    display: flex;
    gap: 20px;
    flex-shrink: 0;
}

.control-group label {
    margin-bottom: 10px;
    font-weight: bold;
    color: #5d4037;
    font-size: 1.1rem;
}

input[type="file"] {
    padding: 10px;
    background: #f8f4e1;
    border: 2px dashed #a67c52;
    border-radius: 10px;
    width: 100%;
    cursor: pointer;
}

button {
    padding: 12px 25px;
    background: #5d4037;
    color: #f5f1e6;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    display: block;
    max-width: 350px;
    min-width: 150px;
    margin-top: 10px;
}

button:hover {
    background: #795548;
    transform: translateY(-2px);
}

.instructions {
    background: #e9d6ab;
    border-radius: 15px;
    padding: 25px;
    margin-top: 25px;
    width: 100%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border: 1px solid #d4bf8a;
}

.instructions h2 {
    color: #5d4037;
    margin-bottom: 15px;
    text-align: center;
}

.step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f4e1;
    border-radius: 10px;
}

.step-number {
    background: #d32f2f;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #5d4037;
}

.step-desc {
    color: #7d5d47;
    line-height: 1.5;
}

.status-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 15px;
    background: rgba(93, 64, 55, 0.8);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    z-index: 100;
}

.keyboard-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.key {
    background: #5d4037;
    color: white;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: bold;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

@media (max-width: 1000px) {
    .map-container {
        height: 500px;
    }
}

@media (max-width: 650px) {
    .compass-container {
        width: 250px;
        height: 250px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .map-container {
        height: 400px;
    }
}

/* 手机端适配 */
@media (max-width: 480px) {
    body {
        padding: 10px;
        font-size: 14px;
    }
    
    header {
        padding: 15px 10px;
        margin-bottom: 10px;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    #showContainer {
        flex-direction: column;
        min-height: auto;
    }
    
    #starsContainer {
        width: 100%;
        min-height: auto;
        margin: 10px;
        padding: 15px;
        order: 2;
    }
    
    .map-container {
        height: 300px;
        margin: 10px;
        order: 1;
    }
    
    .compass-container {
        width: 200px;
        height: 200px;
    }
    
    .search-container {
        flex-direction: column;
        padding: 15px;
        gap: 8px;
    }
    
    .search-container button {
        width: 100%;
        min-width: auto;
        max-width: none;
        margin: 5px 0;
        font-size: 14px;
        padding: 10px 15px;
    }
    

    
    .search-container input {
        width: 100%;
        font-size: 14px;
    }
    
    .control-panel {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .control-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .control-group button {
        width: 100%;
        margin: 5px 0;
    }
    
    .step {
        flex-direction: column;
        text-align: center;
        padding: 10px;
    }
    
    .step-number {
        margin: 0 auto 10px;
    }
    
    .keyboard-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .key {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
    
    .flying-star-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2px;
    }
    
    .flying-star-cell {
        min-height: 60px;
        min-width: 80px;
        font-size: 12px;
    }
    
    .flying-star-base,
    .flying-star-mountain,
    .flying-star-face {
        font-size: 16px;
    }
    
    .flying-star-position {
        font-size: 16px;
    }
}

@media (max-width: 375px) {
    .compass-container {
        width: 180px;
        height: 180px;
    }
    
    .map-container {
        height: 250px;
    }
    
    .flying-star-cell {
        min-height: 50px;
        min-width: 70px;
    }
    
    .flying-star-base,
    .flying-star-mountain,
    .flying-star-face {
        font-size: 14px;
    }
}

@media (max-width: 320px) {
    .compass-container {
        width: 160px;
        height: 160px;
    }
    
    .map-container {
        height: 200px;
    }
    
    .flying-star-cell {
        min-height: 45px;
        min-width: 60px;
    }
    
    .flying-star-base,
    .flying-star-mountain,
    .flying-star-face {
        font-size: 12px;
    }
}

/* 平板端适配 */
@media (min-width: 481px) and (max-width: 768px) {
    #showContainer {
        flex-direction: column;
    }
    
    #starsContainer {
        width: 100%;
        min-height: auto;
        margin: 15px;
        order: 2;
    }
    
    .map-container {
        height: 400px;
        margin: 15px;
        order: 1;
    }
    
    .search-container {
        flex-wrap: wrap;
    }
    
    .search-container button,
    .download-buttons button {
        flex: 1;
        min-width: 120px;
        font-size: 14px;
        width: auto;
        max-width: none;
        margin: 5px 0;
        padding: 10px 15px;
    }
}

/* 横屏模式适配 */
@media (max-height: 500px) and (orientation: landscape) {
    #showContainer {
        flex-direction: row;
    }
    
    #starsContainer {
        width: 250px;
        margin: 10px;
    }
    
    .map-container {
        height: calc(100vh - 200px);
        margin: 10px;
    }
    
    .compass-container {
        width: 150px;
        height: 150px;
    }
    
    .control-panel {
        padding: 10px;
    }
    
    .instructions {
        display: none;
    }
}

/* 触摸设备优化 */
@media (hover: none) {
    button:hover {
        transform: none;
    }
    
    .compass-container {
        cursor: grab;
    }
    
    .compass-container:active {
        cursor: grabbing;
    }
}

/* 防止内容溢出 */
* {
    max-width: 100%;
    box-sizing: border-box;
}

/* 滚动条优化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#baiduMap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    border: none;
    box-sizing: border-box;
}

#mapSearchContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(248, 244, 225, 0.98);
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-shrink: 0;
    background: #e9d6ab;
    border-radius: 15px;
    padding: 15px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #d4bf8a;
    justify-content:center;
    align-items: center;
    /* vertical-align: middle; */
}

.search-container input {
    padding: 8px;
    border: 1px solid #8B4513;
    border-radius: 25px;
    background: #eee5b8;
    color: #5d4037;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    font-size: 14px;
    margin: 5px 0;
    min-height: 40px;
    width: 300px;
}

.search-container button {
    padding: 12px 25px;
    background: #de650e !important;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    width: auto;
    min-width: 200px;
    max-width: 350px;
    height: 45px;
    margin-top: 0;
}

#yunSelect {
    padding: 8px;
    border: 1px solid #8B4513;
    /* border-radius: 25px; */
    background: #eee5b8;
    color: #5d4037;
    /* box-shadow: 0 3px 8px rgba(0,0,0,0.2); */
    font-size: 14px;
    margin: 5px 0;
    min-height: 40px;
    width: 220px;
}

.search-container input[type="file"] {
    padding: 1px;
    background: #f8f4e1;
    border: 1px dashed #a67c52;
    border-radius: 10px;
    width: 50%;
    cursor: pointer;
    height: 40px;
}

.search-container label {
    font-weight: bold;
    color: #5d4037;
    font-size: 1.2rem;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
}

.download-buttons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
    width: 100%;
}

.download-buttons button {
    width: auto;
    min-width: 150px;
    max-width: 350px;
    margin: 0;
}

@media (min-width: 769px) {
    .download-buttons {
        justify-content: flex-end;
    }
    .download-buttons button {
        min-width: 150px;
        max-width: 350px;
    }
    
}

@media (max-width: 768px) {
    .download-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin: 15px 0;
        width: 100%;
    }
    .download-buttons button {
        width: 100%;
        max-width: 350px;
        margin: 5px 0;
        font-size: 14px;
        padding: 10px 15px;
    }

    .search-container button {
        width: 100%;
        max-width: 350px;
        margin: 5px 0;
        font-size: 14px;
        padding: 10px 15px;
    }
}

@media (max-width: 480px) {
    .download-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin: 15px 0;
    }
    
    .search-container button {
        width: 100%;
        max-width: 350px;
        margin: 5px 0;
        font-size: 14px;
        padding: 10px 15px;
    
    }
    .download-buttons button {
        width: 100%;
        max-width: 350px;
        margin: 5px 0;
        font-size: 14px;
        padding: 10px 15px;
    }
}

/* 飞星盘样式 */
.flying-star-result {
    /* background: #e9d6ab; */
    text-align: center;
}

.flying-star-result h3 {
    color: #8B4513;
    margin-bottom: 15px;
    font-size: 24px;
}

.flying-star-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* gap: 0px; */
    /* margin: 15px 0; */
    /* max-width: 300px; */
    /* margin-left: auto;
    margin-right: auto; */
}

.flying-star-cell {
    border: 1px solid #8B4513;
    padding: 0px;
    background: #f8f4e1;
    /* border-radius: 5px; */
    /* font-size: 14px; */
    min-height: 80px;
    min-width: 100px;
    margin: 0px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.flying-star-stars {
    display: flex;
    justify-content: space-around;
    font-size: 12px;
    flex-direction: column;
}

.flying-star-mountainface {
    display: flex;
    justify-content: space-around;
    flex-direction: row;
    /* gap: 20px; */
}

.flying-star-position {
    font-weight: bold;
    color: #999;
    font-size: 22px;
    margin-bottom: 5px;
}

.flying-star-base {
    font-weight: bold;
    color: #f0b208;
    font-size: 22px;
    margin-bottom: 5px;
}

.flying-star-mountain {
    font-weight: bold;
    color: #8B4513;
    font-size: 22px;
    margin-top: 5px;
}

.flying-star-face {
    font-weight: bold;
    color: #1835dc;
    font-size: 22px;
    margin-top: 5px;
}



.flying-star-star {
    padding: 2px 5px;
    border-radius: 3px;
    margin: 1px;
}

.yun-star { background-color: #FFE4B5; }
.shan-star { background-color: #E6E6FA; }
.xiang-star { background-color: #F0E68C; }

.flying-star-info {
    margin: 15px 0;
    text-align: left;
    font-size: 14px;
    line-height: 1.6;
}

.flying-star-info p {
    margin: 5px 0;
    color: #5d4037;
}

#closeFlyingStarBtn {
    margin-top: 15px;
    align-self: center;
    align-items: center;
    justify-content: center;
    align-content: center;
}

.control-group select {
    padding: 8px;
    border: 1px solid #8B4513;
    border-radius: 4px;
    background: #f8f4e1;
    color: #5d4037;
    font-size: 14px;
    margin: 5px 0;
}
