/**
 * 一笔画关卡生成器 - 自定义样式
 * 优化视觉效果和用户体验
 */

/* 全局样式重置和基础设置 */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
}

/* 容器和布局优化 */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 设置面板样式 */
.settings-panel {
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(203, 213, 225, 0.6);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.settings-panel:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* 输入控件样式优化 */
input[type="number"], select {
    transition: all 0.2s ease;
    border: 2px solid #d1d5db;
    background: rgba(248, 250, 252, 0.9);
    color: #1f2937;
}

input[type="number"]:focus, select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

input[type="number"]:hover, select:hover {
    border-color: #9ca3af;
    background: rgba(255, 255, 255, 1);
}

/* 按钮样式增强 */
button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover:before {
    left: 100%;
}

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

button:disabled:hover:before {
    left: -100%;
}

/* 生成按钮特殊效果 */
#generateBtn {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

#generateBtn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    transform: translateY(-2px);
}

#generateBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

/* 查看答案按钮样式 */
#showAnswerBtn {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
}

#showAnswerBtn:hover:not(:disabled) {
    background: linear-gradient(135deg, #047857, #065f46);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
    transform: translateY(-2px);
}

/* 棋盘容器样式 */
.board-container {
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(203, 213, 225, 0.6);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.board-wrapper {
    min-height: 300px;
    padding: 20px;
}

/* 棋盘网格样式 */
#game-board {
    position: relative;
    background: #f1f5f9;
    border: 3px solid #cbd5e1;
    border-radius: 12px;
    padding: 15px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

#game-board:hover {
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* 棋盘格子基础样式 */
.board-cell {
    border: 2px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    user-select: none;
}

/* 空白格子样式 */
.cell-empty {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-color: #d1d5db;
    color: #64748b;
}

.cell-empty:hover {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-color: #9ca3af;
}

/* 路径格子样式 */
.cell-path {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    border-color: #94a3b8;
    color: #1f2937;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.cell-path:hover {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    transform: scale(1.05);
    z-index: 10;
}

/* 起点样式 */
.cell-start {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    border-color: #1e3a8a;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.5), inset 0 1px 3px rgba(255, 255, 255, 0.2);
    font-size: 16px;
    font-weight: 900;
}

.cell-start:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.6), inset 0 1px 3px rgba(255, 255, 255, 0.2);
}

/* 终点样式 */
.cell-end {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-color: #991b1b;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.5), inset 0 1px 3px rgba(255, 255, 255, 0.2);
    font-size: 16px;
    font-weight: 900;
}

.cell-end:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.6), inset 0 1px 3px rgba(255, 255, 255, 0.2);
}

/* 高亮效果 */
.highlight-start, .highlight-end {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(59, 130, 246, 0.8);
        transform: scale(1.05);
    }
}

/* 路径覆盖层 */
.path-overlay {
    pointer-events: none;
}

.path-overlay path {
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 信息面板样式 */
.info-panel {
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(203, 213, 225, 0.6);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

/* 难度指标样式优化 */
#difficulty-metrics .flex {
    padding: 8px 0;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

#difficulty-metrics .flex:hover {
    background-color: rgba(241, 245, 249, 0.6);
}

/* JSON显示区域 */
#json-display {
    background: rgba(241, 245, 249, 0.8);
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: #1f2937;
}

/* 生成状态显示 */
#generation-status {
    padding: 16px;
    text-align: center;
    color: #1f2937;
}

/* 旋转动画 */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 蓝色背景提示框 */
.bg-blue-50 {
    background-color: rgba(239, 246, 255, 0.8) !important;
    border: 1px solid #bfdbfe;
}

/* 空棋盘提示信息 */
.empty-board-message {
    color: #64748b;
    font-size: 16px;
    font-weight: 500;
    padding: 32px;
    text-align: center;
    background: rgba(241, 245, 249, 0.6);
    border-radius: 8px;
    border: 2px dashed #cbd5e1;
}

.empty-board-message:hover {
    background: rgba(226, 232, 240, 0.8);
    border-color: #94a3b8;
}

/* 动画效果 */
@keyframes cellFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes drawPath {
    from {
        stroke-dashoffset: 100%;
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes fadeInMarker {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .controls-panel {
        flex-direction: column;
    }
    
    button {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .board-wrapper {
        padding: 16px;
    }
    
    #game-board {
        padding: 12px;
    }
    
    .board-cell {
        font-size: 12px;
    }
    
    .cell-start, .cell-end {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .settings-panel .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .board-wrapper {
        padding: 12px;
    }
    
    #game-board {
        padding: 8px;
    }
    
    .board-cell {
        font-size: 11px;
    }
    
    .cell-start, .cell-end {
        font-size: 13px;
    }
    
    #json-display {
        font-size: 10px;
        padding: 12px;
    }
}


/* 打印样式 */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .controls-panel, #generation-status {
        display: none;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .board-container, .info-panel {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}


/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-spin {
        animation: none;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.8);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.8);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.9);
}

/* 文字选择样式 */
::selection {
    background: rgba(59, 130, 246, 0.2);
    color: #1f2937;
}

/* 焦点样式 */
:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

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

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.95);
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

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