* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: #333;
}

/* 登录容器 */
#login-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 400px;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease-in-out;
}

#login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #4a5568;
    font-size: 24px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #4a5568;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

#login-btn:active {
    transform: translateY(0);
}

/* 游戏容器 */
#game-container {
    text-align: center;
    width: 90%;
    max-width: 500px;
    animation: fadeIn 0.5s ease-in-out;
}

#game-container h1 {
    color: white;
    margin-bottom: 25px;
    font-size: 32px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#score {
    font-size: 28px;
    margin-bottom: 25px;
    color: white;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    display: inline-block;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.tile {
    width: 100%;
    padding-bottom: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tile:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.tile:active {
    transform: scale(0.95);
}

.tile::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.tile.color-1::after {
    content: '🍎';
}

.tile.color-2::after {
    content: '🍌';
}

.tile.color-3::after {
    content: '🍇';
}

.tile.color-4::after {
    content: '🍒';
}

.tile.color-5::after {
    content: '🍓';
}

#restart-btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    background: white;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    #login-container {
        padding: 25px;
    }
    
    #game-board {
        gap: 8px;
        padding: 10px;
    }
    
    .tile::after {
        font-size: 22px;
    }
    
    #game-container h1 {
        font-size: 28px;
    }
    
    #score {
        font-size: 24px;
    }
}

/* 后端管理界面样式 */
#admin-login-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 400px;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease-in-out;
}

#admin-login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #4a5568;
    font-size: 24px;
    font-weight: 600;
}

#admin-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 800px;
    margin: 20px auto;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease-in-out;
}

#admin-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #4a5568;
    font-size: 28px;
    font-weight: 600;
}

#data-container {
    margin-top: 30px;
}

#data-container h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}

.device-data {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.device-data:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.device-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
}

.device-header:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.device-content {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: none;
    background-color: #f8fafc;
    transition: all 0.3s ease;
}

.device-content.expanded {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.data-item {
    margin-bottom: 15px;
}

.data-label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 5px;
    display: block;
}

.data-item pre {
    background: white;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.4;
}

.delete-btn {
    background-color: #f56565;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background-color: #e53e3e;
    transform: translateY(-1px);
}

#change-credentials {
    margin-top: 40px;
    padding: 25px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background-color: #f8fafc;
    transition: all 0.3s ease;
}

#change-credentials:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#change-credentials h3 {
    margin-bottom: 20px;
    color: #4a5568;
    font-size: 18px;
    font-weight: 600;
}

#credential-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#credential-form input {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

#credential-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#save-credentials {
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#save-credentials:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

#logout-btn {
    margin-top: 30px;
    padding: 12px 24px;
    background: rgba(74, 85, 104, 0.1);
    color: #4a5568;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#logout-btn:hover {
    background: rgba(74, 85, 104, 0.2);
    transform: translateY(-2px);
}

/* 数据记录样式 */
.data-record {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.data-record:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.data-record h4 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

/* 紧凑数据项样式 */
.data-item.compact {
    margin-bottom: 8px;
}

.data-item.compact .data-label {
    font-size: 12px;
    margin-bottom: 3px;
}

.data-item.compact pre {
    padding: 8px;
    font-size: 12px;
    line-height: 1.2;
    max-height: 150px;
    overflow-y: auto;
}

/* 设备数据容器样式 */
.device-data {
    margin-bottom: 12px;
}

.device-header {
    padding: 12px 15px;
    font-size: 14px;
}

.device-content {
    padding: 15px;
}

/* 数据容器滚动优化 */
#devices-list {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 5px;
}

/* 滚动条样式 */
#devices-list::-webkit-scrollbar {
    width: 6px;
}

#devices-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#devices-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#devices-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}