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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

input, select, textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

/* 只让普通的文本输入框和文本区域占满宽度 */
input[type="text"], textarea {
    width: 100%;
}

.fortune-types {
    margin: 20px 0;
}

.fortune-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.fortune-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    background-color: #fff;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.fortune-btn.active {
    background-color: #2c3e50;
    color: white;
}

.submit-btn {
    width: 100%;
    padding: 15px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 20px;
    position: relative;
    transition: background-color 0.3s;
}

.submit-btn:hover {
    background-color: #c0392b;
}

.submit-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.submit-btn.loading {
    background-color: #95a5a6;
}

.loading-text {
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% {
        content: "测算中.";
    }
    40% {
        content: "测算中..";
    }
    60%, 100% {
        content: "测算中...";
    }
}

/* 适配移动端 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .fortune-btn {
        font-size: 13px;
        padding: 8px 15px;
    }
}

.result-container {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: 150px;
    background: white;
    z-index: 99;
    display: flex;
    flex-direction: column;
    padding: 0 20px;
    max-width: 600px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.result-container h2 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.result-content {
    line-height: 1.6;
    white-space: pre-line;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input[type="radio"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

.radio-label span {
    font-size: 16px;
}

.horizontal-group {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.form-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-field label {
    margin-bottom: 8px;
}

/* 调整日期输入框的宽度 */
.form-field input[type="datetime-local"] {
    width: auto;
    min-width: 230px;  /* 调整合适的最小宽度 */
}

/* 在移动端的特殊处理 */
@media (max-width: 480px) {
    .horizontal-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-field {
        width: 100%;
    }

    .form-field input[type="datetime-local"] {
        width: 100%;  /* 在移动端占满宽度 */
    }
}

/* Markdown 样式 */
.markdown-body {
    line-height: 1.6;
    color: #24292e;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-body h1 {
    font-size: 2em;
}

.markdown-body h2 {
    font-size: 1.5em;
}

.markdown-body h3 {
    font-size: 1.25em;
}

.markdown-body p {
    margin-bottom: 16px;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 16px;
    padding-left: 2em;
}

.markdown-body li {
    margin: 0.25em 0;
}

.markdown-body code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background-color: rgba(27,31,35,0.05);
    border-radius: 3px;
    font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;
}

.markdown-body pre {
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f6f8fa;
    border-radius: 3px;
    margin-bottom: 16px;
}

.markdown-body blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
    margin: 0 0 16px 0;
}

.markdown-body hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: #e1e4e8;
    border: 0;
}

.markdown-body table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-bottom: 16px;
    width: 100%;
}

.markdown-body table th,
.markdown-body table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

.markdown-body table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

/* 结果标题栏样式 */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.result-header h2 {
    margin: 0;
}

/* 复制按钮样式 */
.copy-btn {
    padding: 6px 12px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.copy-btn:hover {
    background-color: #e9ecef;
    border-color: #ccc;
}

.copy-btn:active {
    background-color: #dde0e3;
}

/* 复制成功后的样式 */
.copy-btn .copy-text {
    transition: all 0.3s ease;
}

/* 添加到样式文件中 */
textarea.temp-copy {
    position: fixed;
    top: -9999px;
    left: -9999px;
    opacity: 0;
}

/* 页脚样式 */
.footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    font-size: 12px;
    color: #666;
}

.footer p {
    margin: 5px 0;
}

.footer a {
    color: #666;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.subtitle {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    margin-top: -10px;
    margin-bottom: 20px;
}

.visit-counter {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 20px;
}

#visitCount {
    color: #e74c3c;
    font-weight: bold;
}

.form-wrapper {
    transition: all 0.3s ease;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.form-wrapper.collapsed {
    margin-bottom: 10px;
    position: fixed;  /* 折叠时固定定位 */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    max-width: 600px;
    margin: 0 auto;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    background: white;
    border-radius: 8px;
}

.form-header-placeholder {
    display: none;
}

.user-info {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.3s ease;
}

.form-wrapper.collapsed .expand-btn {
    transform: rotate(-90deg);
}

.form-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.form-wrapper.collapsed .form-content {
    max-height: 0;
    padding: 0;
    opacity: 0;
}

.form-wrapper.expanded .form-content {
    max-height: 2000px;
    opacity: 1;
    padding: 20px;
}

/* 聊天容器样式 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px;  /* 为底部输入框留出空间 */
}

.message {
    margin-bottom: 20px;
    max-width: 90%;  /* 增加最大宽度 */
}

.message.assistant {
    width: 100%;  /* AI 消息占满宽度 */
    max-width: 100%;  /* AI 消息占满宽度 */
}

.message.user {
    margin-left: auto;
    max-width: 80%;  /* 用户消息保持原来的宽度 */
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
    word-wrap: break-word;
}

.message.assistant .message-content {
    background: white;
    margin-right: auto;
}

.message.user .message-content {
    background: #95ec69;
    margin-left: auto;
}

.chat-input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 15px;
    outline: none;
    font-size: 14px;
}

.chat-send-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 14px;
}

.chat-send-btn:hover {
    background: #c0392b;
}

.chat-send-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* 优化滚动条样式 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

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

/* 添加页脚隐藏样式 */
.footer.hidden {
    display: none;
}

/* 添加访问计数隐藏样式 */
.visit-counter.hidden {
    display: none;
}

/* 当表单展开时，调整结果容器位置 */
.form-wrapper.expanded + .result-container {
    top: 600px;  /* 为展开的表单留出足够空间 */
}

/* 当表单折叠时，调整结果容器位置 */
.form-wrapper.collapsed + .result-container {
    top: 70px;
} 