/* 基础样式 */
:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --text-color: #2d3436;
    --light-gray: #f5f6fa;
    --medium-gray: #dfe6e9;
    --dark-gray: #636e72;
    --correct-color: #00b894;
    --partial-color: #fdcb6e;
    --incorrect-color: #b2bec3;
    --shadow: 0 8px 16px rgba(108, 92, 231, 0.1);
    --border-radius: 12px;
    --gradient-primary: linear-gradient(135deg, #6c5ce7, #a29bfe);
    --gradient-secondary: linear-gradient(135deg, #a29bfe, #6c5ce7);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #f5f6fa 0%, #dfe6e9 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* 头部样式 */
header {
    background: var(--gradient-primary);
    box-shadow: var(--shadow);
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 45px;
    transition: transform 0.3s ease;
}

.logo img:hover {
    transform: scale(1.05);
}

nav {
    display: flex;
    align-items: center;
}

nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.8rem;
    align-items: center;
}

nav ul li {
    margin: 0;
    display: flex;
    align-items: center;
}

/* 导航按钮样式 */
.nav-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.nav-button img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
    display: block;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.nav-button:hover img {
    transform: scale(1.1);
}

/* 主要内容区域 */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* 加载屏幕 */
#loading {
    text-align: center;
    padding: 3rem;
    animation: fadeIn 0.5s ease;
}

#loading h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

#progress-container {
    width: 80%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    height: 24px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

#progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#progress-text {
    margin-top: 10px;
    font-weight: bold;
    color: var(--dark-gray);
}

/* 游戏容器 */
#game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    box-shadow: var(--shadow);
    position: relative;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

#game-container:hover {
    transform: translateY(-5px);
}

#game-container h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

/* 游戏控制区修改为水平排列 */
.game-controls {
    margin: 1.5rem 0;
    display: flex;
    /* 修改为水平排列 */
    flex-direction: row;
    /* 居中对齐 */
    justify-content: center;
    align-items: center;
}

#difficulty-selection {
    margin-bottom: 1.5rem;
    text-align: center;
}

#difficulty-selection select {
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    background-color: white;
}

/* 消息提示框 */
#message {
    background: var(--gradient-primary);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    color: white;
    text-align: center;
    min-height: 50px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.5s ease;
    line-height: 1.6;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

#message p {
    margin: 0.3rem 0;
    font-size: 1rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 按钮样式 */
button {
    font-size: 1.1rem;
    padding: 0.8rem 1.8rem;
    margin: 0.5rem;
    border: none;
    border-radius: var(--border-radius);
    background: var(--gradient-primary);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(108, 92, 231, 0.2);
}

button:active {
    transform: translateY(-1px);
}

/* 搜索框样式 */
.input-area {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 2rem auto;
}

.input-area input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--medium-gray);
    border-radius: 12px;
    background: white;
    color: var(--text-color);
    font-size: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.input-area input:focus {
    outline: none;
}

.input-area input::placeholder {
    color: var(--dark-gray);
}

/* 搜索结果样式 */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--medium-gray);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    padding: 8px;
}

.search-results.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb {
    background: var(--medium-gray);
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: var(--dark-gray);
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 8px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--light-gray);
    transition: background-color 0.2s ease;
}

.search-result-item:last-child {
    margin-bottom: 0;
}

.search-result-item:hover {
    background-color: var(--medium-gray);
}

.search-result-item .song-id {
    color: var(--primary-color);
    font-size: 0.9em;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(108, 92, 231, 0.1);
    flex-shrink: 0;
}

.search-result-item .song-name {
    color: var(--text-color);
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95em;
}

/* 提示容器 */
#hints-container {
    margin-top: 2rem;
    display: grid;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: none; /* 默认隐藏 */
}

.hint-line {
    margin: 0.3rem 0;
    padding: 0.3rem 0.8rem;
    border-radius: var(--border-radius);
    display: inline-block;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
}

.hint-correct {
    background-color: rgba(0, 184, 148, 0.1);
    color: var(--correct-color);
}

.hint-partial {
    background-color: rgba(253, 203, 110, 0.1);
    color: var(--partial-color);
}

.hint-incorrect {
    background-color: rgba(178, 190, 195, 0.1);
    color: var(--dark-gray);
}

/* 关于模态框 */
#about-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    z-index: 1100;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#about-modal h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 0.5rem;
}

#about-modal p {
    margin-bottom: 0.8rem;
}

#close-about {
    background-color: var(--secondary-color);
    margin-top: 1rem;
}

#modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

/* 猜测提示样式 */
.guess-block {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
    display: flex;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.guess-block:hover {
    transform: translateY(-3px);
}

.guess-top {
    display: flex;
    align-items: flex-start;
    padding: 0.5rem;
    border-bottom: 1px solid var(--light-gray);
    flex: 1;
}

.guess-left {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.guess-title {
    font-weight: bold;
    margin-bottom: 0.8rem;
    color: var(--dark-gray);
}

.jacket-img {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

.guess-bottom {
    padding: 0.5rem;
}

.hint-line {
    margin: 0.3rem 0;
    padding: 0.3rem 0.8rem;
    border-radius: var(--border-radius);
    display: inline-block;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
}

/* 响应式布局 */
@media screen and (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    #game-container {
        padding: 1.5rem;
    }
    
    button {
        font-size: 1rem;
        padding: 0.6rem 1.2rem;
    }
    
    #about-modal {
        width: 95%;
        padding: 1.5rem;
    }
    
    .guess-block {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
    }

    .guess-top {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        border-bottom: none;
        padding-bottom: 0.3rem;
        margin-bottom: 0.3rem;
        border-bottom: 0.5px solid var(--light-gray);
        gap: 0.5rem;
        position: relative;
    }

    .guess-left {
        align-items: flex-start;
        margin-bottom: 0;
        flex: 1;
        padding-right: 50px;
    }

    .guess-left .hint-line {
        margin: 0.1rem 0; /* 增加上半部分标签的上下间距 */
    }

    .jacket-img {
        width: 160px;
        height: 160px;
        margin: 0;
        position: absolute;
        right: 0;
        top: 0;
    }

    .guess-bottom {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
        padding: 0.3rem;
    }

    .hint-line {
        margin: 0;
        padding: 0.3rem 0.5rem;
        font-size: 0.9rem;
    }
}

/* 桌面端特定样式 */
@media screen and (min-width: 769px) {
    .guess-block {
        gap: 2.5rem;
    }

    .guess-top {
        gap: 1.5rem;
    }
}

/* 响应式调整 */
@media screen and (max-width: 480px) {
    header {
        flex-direction: column;
        padding: 0.8rem;
    }
    
    nav ul {
        margin-top: 0.8rem;
    }
    
    nav ul li {
        margin: 0 0.5rem;
    }
    
    #game-container h1 {
        font-size: 1.5rem;
    }
    
    button {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
        margin: 0.3rem;
    }
    
    #guess-id {
        width: 100%;
        font-size: 1rem;
    }
    
    #search-results {
        left: 0;
        width: 100%;
        transform: none;  /* 重置transform属性 */
    }
    
    .guess-top {
        flex-direction: column;
    }
    
    .jacket-img {
        margin: 0.8rem 0 0 0;
        width: 70px;
        height: 70px;
    }
    
    #about-modal {
        padding: 1rem;
    }
    
    .title-container {
        flex-direction: column;
        align-items: center;
    }
    
    /* .author {
        margin: 0.5rem 0 0 0;
    } */

    .nav-button {
        width: 36px;
        height: 36px;
    }
    
    .nav-button img {
        width: 18px;
        height: 18px;
    }

    .input-area {
        max-width: 100%;
        margin: 1.5rem auto;
    }
    
    .input-area input {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .search-results {
        max-height: 250px;
        padding: 6px;
    }
    
    .search-result-item {
        padding: 6px 10px;
        margin-bottom: 3px;
    }
    
    .search-result-item .song-id {
        font-size: 0.85em;
        padding: 2px 4px;
    }

    .search-result-item .song-name {
        font-size: 0.9em;
    }
}

/* 小型手机 */
@media screen and (max-width: 320px) {
    body {
        font-size: 12px;
    }
    
    #game-container {
        padding: 1rem;
    }
    
    button {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
        margin: 0.2rem;
    }
}

/* 页脚 */
footer {
    background: var(--gradient-primary);
    color: white;
    padding: 2rem;
    text-align: center;
    margin-top: 3rem;
}

footer p {
    margin: 0.5rem 0;
    opacity: 0.9;
}

footer a {
    color: white;
    text-decoration: underline;
    transition: opacity 0.3s ease;
}

footer a:hover {
    opacity: 0.8;
}

/* 添加标题容器样式 */
.title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.title-container h1 {
    margin: 0;
    color: var(--primary-color);
}

.author {
    margin: -1em 0 0 1.2rem;
    color: var(--dark-gray);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 1.2rem;
}

.author::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 70%;
    width: 1px;
    background-color: var(--dark-gray);
    opacity: 0.5;
}