/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding-bottom: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    padding: 20px 10px;
    color: white;
    margin-bottom: 20px;
    position: relative;
}

.title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.user-info {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-phone {
    font-size: 12px;
    opacity: 0.9;
}

.logout-btn-header {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

/* 输入区域 */
.input-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 10px;
}

.number-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    min-height: 200px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

.number-input:focus {
    outline: none;
    border-color: #667eea;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.analyze-btn {
    flex: 1;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.3s;
}

.analyze-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.example-btn {
    padding: 14px 20px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.example-btn:hover {
    background: #e0e0e0;
}

.count-info {
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    background: #e3f2fd;
    border-radius: 6px;
}

.count-text {
    font-size: 14px;
    color: #1976d2;
    font-weight: 500;
}

.limit-notice {
    margin-top: 15px;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    text-align: center;
    color: #856404;
    font-size: 14px;
}

.login-prompt {
    margin-top: 15px;
    padding: 12px;
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 8px;
    text-align: center;
    color: #1976d2;
    font-size: 14px;
}

.login-prompt a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
}

.login-prompt a:hover {
    text-decoration: underline;
}

/* 结果展示区域 */
.results-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.predictions-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.prediction-card {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s;
}

.prediction-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.pattern-card-active {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 主可视化画布容器 */
.main-visualization-container {
    margin-bottom: 20px;
}

.main-pattern-canvas {
    width: 100%;
    height: auto;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    max-height: 600px;
}

.prediction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.prediction-number {
    font-weight: bold;
    color: #667eea;
    font-size: 16px;
}

.prediction-type {
    background: #667eea;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.prediction-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.5;
}

.confidence-bar {
    margin-bottom: 10px;
}

.confidence-label {
    font-size: 12px;
    color: #999;
    margin-right: 8px;
}

.confidence-progress {
    display: flex;
    align-items: center;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    margin-top: 5px;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.confidence-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: bold;
    color: #333;
    z-index: 1;
}

.prediction-result {
    padding: 10px;
    background: white;
    border-radius: 6px;
    margin-bottom: 10px;
}

.result-label {
    font-size: 14px;
    color: #666;
}

.result-value {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    margin-left: 8px;
}

.pattern-visualization {
    margin-top: 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
}

.pattern-canvas {
    width: 100%;
    height: auto;
    border: none;
    background: white;
    display: block;
    min-height: 300px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
}

/* 数字展示区域 */
.numbers-display-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.numbers-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.number-row {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.unknown-row {
    background: #fff3cd;
    border-left-color: #ffc107;
}

.row-number {
    min-width: 30px;
    font-size: 12px;
    color: #999;
    margin-right: 10px;
}

.row-digits {
    display: flex;
    gap: 8px;
    flex: 1;
}

.digit {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
}

.digit.highlight {
    background: #ffeb3b;
    border-color: #ffc107;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
}

.digit.predicted {
    background: #4caf50;
    color: white;
    border-color: #388e3c;
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 15px;
    cursor: pointer;
    transition: color 0.3s;
    color: #999;
}

.nav-item.active {
    color: #667eea;
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.nav-text {
    font-size: 12px;
}

/* 历史记录页面 */
.history-section,
.profile-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 80px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-height: 300px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.history-date {
    font-size: 12px;
    color: #666;
}

.history-count {
    font-size: 12px;
    color: #667eea;
    font-weight: bold;
}

.history-numbers {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #333;
    white-space: pre-line;
    max-height: 60px;
    overflow: hidden;
}

/* 用户中心 */
.profile-card {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.profile-item:last-child {
    border-bottom: none;
}

.profile-label {
    color: #666;
    font-size: 14px;
}

.profile-value {
    color: #667eea;
    font-size: 16px;
    font-weight: bold;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.contact-btn,
.help-btn {
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.2s;
}

.help-btn {
    background: #f0f0f0;
    color: #333;
}

.contact-btn:hover,
.help-btn:hover {
    transform: translateY(-2px);
}

.help-content {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.help-content h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.help-content ol {
    padding-left: 20px;
}

.help-content li {
    margin-bottom: 8px;
    color: #666;
    line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .title {
        font-size: 20px;
    }
    
    .digit {
        width: 30px;
        height: 30px;
        line-height: 30px;
        font-size: 14px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .example-btn {
        width: 100%;
    }
}
