/* 全局样式 */
.main-content {
padding: 10px;
}
.card {
border-radius: 6px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
margin-bottom: 12px;
overflow: hidden;
background-color: #fff;
border: none;
}
.card-header {
background-color: #f8f9fa;
padding: 8px 12px;
border-bottom: 1px solid #eee;
}
.card-header h3 {
margin-bottom: 0;
font-size: 15px;
}
.card-body {
padding: 10px 12px;
}
/* 数独游戏容器 */
.sudoku-container {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
margin-bottom: 20px;
}
@media (max-width: 768px) {
.sudoku-container {
grid-template-columns: 1fr;
}
.btn-group {
flex-direction: column;
}
.btn {
width: 100%;
margin-bottom: 8px;
}
.sudoku-board {
max-width: 100% !important;
}
.difficulty-selector {
flex-wrap: wrap;
}
.game-controls {
flex-direction: column;
}
.game-controls .btn {
margin-bottom: 6px;
width: 100%;
}
.number-selector {
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(2, 1fr);
}
.number-button:nth-child(n+6) {
grid-column: span 1;
}
}
/* 按钮样式 */
.btn {
cursor: pointer;
padding: 6px 10px;
border-radius: 4px;
font-weight: 500;
transition: all 0.2s;
display: inline-flex;
align-items: center;
justify-content: center;
margin-right: 8px;
border: none;
font-size: 14px;
}
.btn-primary {
background-color: #4a6ee0;
color: #fff;
}
.btn-primary:hover {
background-color: #3a5dcb;
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.btn-secondary {
background-color: #f0f2f5;
color: #333;
}
.btn-secondary:hover {
background-color: #e1e5ea;
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.btn-danger {
background-color: #e74c3c;
color: #fff;
}
.btn-danger:hover {
background-color: #d62c1a;
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}
.btn-icon {
margin-right: 3px;
}
/* 数独标题 */
.calculator-title {
margin-bottom: 10px;
font-size: 18px;
padding-bottom: 6px;
}
.calculator-icon {
font-size: 20px;
margin-right: 6px;
vertical-align: middle;
}
/* 难度选择器 */
.difficulty-selector {
display: flex;
margin-bottom: 12px;
}
.difficulty-button {
padding: 6px 12px;
margin-right: 4px;
background-color: #f0f2f5;
border: 1px solid #dce0e6;
border-radius: 4px;
cursor: pointer;
transition: all 0.2s;
font-size: 14px;
}
.difficulty-button:hover {
background-color: #e1e5ea;
transform: translateY(-1px);
}
.difficulty-button.active {
background-color: #4a6ee0;
color: white;
border-color: #4a6ee0;
box-shadow: 0 2px 4px rgba(74, 110, 224, 0.3);
}
/* 游戏信息 */
.game-info {
margin-top: 8px;
display: flex;
justify-content: space-between;
}
.timer, .errors {
font-size: 14px;
font-weight: 500;
padding: 6px 10px;
border-radius: 4px;
background-color: #f8f9fa;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.errors {
color: #e74c3c;
}
/* 数独游戏板 */
.sudoku-board {
display: grid;
grid-template-columns: repeat(9, 1fr);
grid-template-rows: repeat(9, 1fr);
gap: 1px;
border: 2px solid #333;
width: 100%;
max-width: 450px;
margin: 0 auto 15px;
aspect-ratio: 1/1;
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}
.sudoku-cell {
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
font-size: 18px;
font-weight: 500;
cursor: pointer;
position: relative;
border: 1px solid #ddd;
transition: all 0.2s ease;
}
.sudoku-cell.prefilled {
background-color: #f8f9fa;
font-weight: 700;
cursor: default;
color: #4a6ee0;
}
.sudoku-cell.selected {
background-color: #e6f0ff;
border-color: #4a6ee0;
box-shadow: inset 0 0 0 2px #4a6ee0;
z-index: 1;
}
.sudoku-cell.error {
color: #e74c3c;
animation: shake 0.5s;
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
20%, 60% { transform: translateX(-2px); }
40%, 80% { transform: translateX(2px); }
}
/* 边框样式，突出3x3宫格 */
.sudoku-cell:nth-child(3n) {
border-right: 2px solid #333;
}
.sudoku-cell:nth-child(9n) {
border-right: none;
}
.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
border-bottom: 2px solid #333;
}
/* 数字选择器 */
.number-selector {
display: grid;
grid-template-columns: repeat(9, 1fr);
gap: 4px;
margin-top: 15px;
margin-bottom: 15px;
max-width: 450px;
margin-left: auto;
margin-right: auto;
}
.number-button {
background-color: #f0f2f5;
border: 1px solid #dce0e6;
border-radius: 4px;
display: flex;
justify-content: center;
align-items: center;
font-size: 16px;
font-weight: 500;
height: 36px;
cursor: pointer;
transition: all 0.2s;
}
.number-button:hover {
background-color: #e1e5ea;
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.number-button.active {
background-color: #4a6ee0;
color: white;
border-color: #4a6ee0;
box-shadow: 0 2px 4px rgba(74, 110, 224, 0.3);
}
/* 游戏控制按钮 */
.game-controls {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 6px;
margin-top: 10px;
}
/* 游戏结束对话框 */
.game-over-dialog {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
display: none;
justify-content: center;
align-items: center;
z-index: 1000;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.dialog-content {
background-color: white;
padding: 20px;
border-radius: 8px;
text-align: center;
max-width: 350px;
width: 90%;
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
animation: scaleIn 0.3s ease;
}
@keyframes scaleIn {
from { transform: scale(0.8); opacity: 0; }
to { transform: scale(1); opacity: 1; }
}
.dialog-title {
font-size: 20px;
margin-bottom: 12px;
color: #4a6ee0;
}
.dialog-message {
font-size: 14px;
margin-bottom: 15px;
}
.dialog-buttons {
display: flex;
justify-content: center;
gap: 10px;
}
/* 游戏规则 */
.game-rules {
background-color: #f8fff2;
padding: 8px;
border-radius: 6px;
margin-top: 12px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
font-size: 14px;
}
.game-rules:hover {
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
transform: translateY(-1px);
}
.game-rules h3 {
margin-top: 0;
margin-bottom: 6px;
color: #2c3e50;
font-size: 15px;
}
.game-rules p, .game-rules li {
margin-bottom: 6px;
line-height: 1.3;
color: #34495e;
}
/* 高亮可放置单元格 */
.sudoku-cell.highlight-valid {
background-color: #e8f5e9;
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { box-shadow: inset 0 0 0 2px rgba(74, 220, 110, 0.4); }
50% { box-shadow: inset 0 0 0 2px rgba(74, 220, 110, 0.7); }
100% { box-shadow: inset 0 0 0 2px rgba(74, 220, 110, 0.4); }
}
/* 减少内容区域的padding */
.main-container .content {
padding: 8px;
}
.wid.nr.tl {
padding: 8px;
margin-bottom: 10px;
font-size: 14px;
}
