:root {
    --bg-color: #ffe4e6;
    /* 浅粉色背景 */
    --text-color: #881337;
    /* 深粉色文字 */
    --accent-color: #be185d;
    /* 强调色 */
    --modal-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.4);
}

/* 定义本地字体 */
@font-face {
    font-family: 'MyCustomFont';
    /* 请将你的字体文件重命名为 font.ttf 并放在项目根目录，或者修改下面的 url */
    src: url('font.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    /* 优先使用自定义字体 */
    font-family: 'MyCustomFont', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #fff0f3 0%, #ffe4e6 50%, #fbcfe8 100%);
    /* 渐变背景 */
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    /* 为背景定位做准备 */
}

/* 全屏按钮样式 */
.fullscreen-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--glass-border);
    color: var(--accent-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.fullscreen-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.1);
}

/* 背景光效 */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* 确保不影响点击 */
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #f9a8d4 0%, rgba(249, 168, 212, 0) 70%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #f472b6 0%, rgba(244, 114, 182, 0) 70%);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #fbcfe8 0%, rgba(251, 207, 232, 0) 70%);
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

#word-cloud-container {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 1rem;
    padding: 2rem;
}

.word-item {
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(190, 24, 93, 0.4);
    /* 初始低饱和度/浅色 */
    -webkit-user-select: none;
    user-select: none;
    padding: 0.5rem;
    border-radius: 8px;
}

.word-item:hover {
    color: var(--accent-color);
    transform: scale(1.2);
    z-index: 10;
    text-shadow: 0 0 10px rgba(190, 24, 93, 0.2);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--modal-bg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    /* 限制最大高度 */
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    position: relative;
    text-align: center;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal.hidden .modal-content {
    transform: translateY(20px);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.close-btn:hover {
    opacity: 1;
}

#modal-keyword {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
}

.message-container {
    min-height: 100px;
    max-height: 50vh;
    /* 限制内容区域高度 */
    overflow-y: auto;
    /* 超出显示滚动条 */
    display: block;
    /* 改为 block 以便更好地控制滚动 */
    margin-bottom: 1.5rem;
    padding: 0 10px;
    /* 增加内边距，避免滚动条遮挡文字 */
}

/* 自定义滚动条样式 */
.message-container::-webkit-scrollbar {
    width: 8px;
}

.message-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.message-container::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
    opacity: 0.7;
}

.message-container::-webkit-scrollbar-thumb:hover {
    background: #9d174d;
}

#modal-message {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #4a041d;
    text-align: left;
}

.highlight {
    color: var(--accent-color);
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.5);
    padding: 0 4px;
    border-radius: 4px;
}

.modal-footer {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pagination-controls.hidden {
    display: none;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-btn:hover {
    background: var(--accent-color);
    color: white;
}

#page-indicator {
    font-size: 0.9rem;
    color: var(--text-color);
}

.loading {
    font-size: 1.2rem;
    color: var(--text-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}