/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    max-width: 600px;
    width: 90%;
}

/* 游戏头部 */
.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-header h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.info-item {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.info-item:hover {
    transform: translateY(-2px);
}

.info-item .label {
    font-weight: 600;
    color: #718096;
}

.info-item span:last-child {
    font-weight: bold;
    color: #2d3748;
    margin-left: 5px;
}

/* 游戏主体 */
.game-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.game-board-container {
    display: flex;
    justify-content: center;
    padding: 20px;
}

/* 控制面板 */
.control-panel {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #8b4513;
}

.btn-success {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #2d5016;
}

.btn-info {
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    color: #4c1d95;
}

.btn-prev {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    color: #2d3748;
}

/* 游戏状态 */
.game-status {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-status p {
    font-size: 1.1rem;
    color: #4a5568;
    font-weight: 500;
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal:not(.hidden) .modal-content {
    transform: scale(1);
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    position: relative;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s ease;
}

.close-btn:hover {
    transform: scale(1.1);
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* 排行榜样式 */
.ranking-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: #718096;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

/* 排行榜样式 */
.ranking-content {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s ease;
}

.ranking-item:hover {
    transform: translateX(5px);
}

.rank-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rank {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 50px;
}

.level-info {
    display: flex;
    flex-direction: column;
}

.level-name {
    font-weight: 600;
    color: var(--text-primary);
}

.games-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.score-info {
    text-align: right;
}

.best-score {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--success-color);
}

.score-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 2px 0;
}

.player-name {
    font-weight: 600;
    color: var(--primary-color);
}

.record-date {
    font-size: 0.7rem;
    opacity: 0.8;
}

.average-score {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* 胜利弹窗样式 */
.victory-content {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
}

.victory-content h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.victory-stats {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.victory-stats p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.new-record {
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.2rem;
    margin-top: 1rem !important;
}

.victory-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* 姓名输入相关样式 */
.victory-step {
    transition: opacity 0.3s ease;
}

.name-input-section {
    margin-top: 1rem;
}

.name-prompt {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.name-input {
    width: 100%;
    max-width: 300px;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1rem;
}

.name-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.name-input::placeholder {
    color: var(--text-secondary);
}

.name-input-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.saved-name {
    color: var(--primary-color);
    font-weight: 500;
    margin-top: 1rem !important;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1001;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}