/* ============================================
   XPuzzle Game - 开始界面（难度选择 + 图片选择）
   ============================================ */

/* ---------- 难度按钮 ---------- */
.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0 34px;
}

.difficulty-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px 22px;
    font-size: 1.15em;
    color: #fff;
    background: linear-gradient(135deg, #2a3a70 0%, #3d2c6b 100%);
    border: 2px solid rgba(180, 120, 60, .35);
    border-radius: 14px;
    cursor: pointer;
    font-weight: bold;
    text-align: left;
    letter-spacing: 1px;
    transition: transform .2s, box-shadow .25s, border-color .25s, background .25s;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(180, 100, 30, .25), inset 0 1px 0 rgba(255, 255, 255, .15);
}

.difficulty-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,.25), transparent);
    transform: skewX(-20deg);
    transition: left .6s ease;
    pointer-events: none;
}

.difficulty-btn:hover {
    transform: translateY(-3px) scale(1.01);
    border-color: rgba(180, 200, 255, .8);
    box-shadow: 0 8px 25px rgba(80, 130, 255, .45), inset 0 1px 0 rgba(255,255,255,.15);
}

.difficulty-btn:hover::before { left: 120%; }
.difficulty-btn:active         { transform: translateY(-1px) scale(.99); }

.diff-icon {
    font-size: 2em;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.5));
    flex-shrink: 0;
}

.diff-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
}

.diff-name {
    font-size: 1.35em;
    font-weight: 900;
    letter-spacing: 3px;
}

.diff-desc {
    font-size: .78em;
    font-weight: normal;
    color: rgba(255,255,255,.65);
    letter-spacing: 1px;
    margin-top: 2px;
}

.diff-badge {
    font-size: .75em;
    font-family: 'Consolas', 'Courier New', monospace;
    padding: 5px 12px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 20px;
    letter-spacing: 2px;
    flex-shrink: 0;
}

/* 三个难度不同色系 */
.difficulty-btn[data-difficulty="easy"] {
    background: linear-gradient(135deg, #1e6f5c 0%, #2a9d8f 100%);
    border-color: rgba(120, 240, 200, .35);
}
.difficulty-btn[data-difficulty="easy"]:hover {
    box-shadow: 0 8px 25px rgba(46, 200, 150, .5), inset 0 1px 0 rgba(255,255,255,.15);
}

.difficulty-btn[data-difficulty="medium"] {
    background: linear-gradient(135deg, #c56b1a 0%, #e76f2c 100%);
    border-color: rgba(255, 200, 130, .4);
}
.difficulty-btn[data-difficulty="medium"]:hover {
    box-shadow: 0 8px 25px rgba(255, 140, 40, .5), inset 0 1px 0 rgba(255,255,255,.15);
}

.difficulty-btn[data-difficulty="hard"] {
    background: linear-gradient(135deg, #8b1a2b 0%, #c9184a 100%);
    border-color: rgba(255, 130, 160, .4);
}
.difficulty-btn[data-difficulty="hard"]:hover {
    box-shadow: 0 8px 25px rgba(230, 40, 90, .55), inset 0 1px 0 rgba(255,255,255,.15);
}

/* 选中态 - 强烈视觉反馈 */
.difficulty-btn.selected {
    transform: translateY(-2px) scale(1.02);
    border-color: #a15c1a;
    box-shadow:
        0 0 0 3px rgba(161, 92, 26, .3),
        0 10px 30px rgba(180, 100, 30, .4),
        inset 0 1px 0 rgba(255, 255, 255, .2);
}

.difficulty-btn.selected::after {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 12px;
    width: 26px;
    height: 26px;
    line-height: 24px;
    text-align: center;
    background: #a15c1a;
    color: #fff8ec;
    border-radius: 50%;
    font-weight: 900;
    font-size: .9em;
    box-shadow: 0 2px 8px rgba(161, 92, 26, .5);
    animation: ringPulse 1.6s ease-out infinite;
}

.difficulty-btn.selected .diff-badge {
    background: rgba(161, 92, 26, .2);
    border-color: #a15c1a;
    color: #a15c1a;
    animation: pulseBadge 1.4s ease-in-out infinite;
}

.difficulty-btn.selected .diff-icon {
    transform: scale(1.15);
    transition: transform .3s ease;
}

/* ---------- 图片选择 ---------- */
.image-section-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0 22px;
    min-height: 44px;
}

.image-section-header .section-title { margin: 0; }

#back-to-difficulty-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

#back-to-difficulty-btn:hover {
    transform: translateY(-50%) translateX(-2px);
}

.image-selector { margin: 20px 0 0; }

.image-options {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 22px;
}

.image-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
    color: #fff;
    border: 2px solid rgba(120, 60, 20, .25);
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 1px;
    transition: transform .2s, box-shadow .25s, border-color .25s, background .25s;
}

.image-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(180, 200, 255, .7);
    box-shadow: 0 6px 18px rgba(217, 119, 6, .5);
}

.image-btn.selected {
    background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
    border-color: #a15c1a;
    box-shadow: 0 0 0 3px rgba(161, 92, 26, .3), 0 6px 18px rgba(217, 119, 6, .5);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.image-item {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid rgba(120, 60, 20, .2);
    transition: transform .2s, border-color .25s, box-shadow .25s;
    background: #f5e9d0;
}

.image-item:hover {
    transform: translateY(-3px) scale(1.03);
    border-color: #d97706;
    box-shadow: 0 8px 22px rgba(217, 119, 6, .45);
}

.image-item.selected {
    border-color: #a15c1a;
    box-shadow: 0 0 0 3px rgba(161, 92, 26, .35), 0 8px 22px rgba(217, 119, 6, .5);
    transform: translateY(-2px) scale(1.04);
}

.custom-image-container { margin-top: 18px; }

#image-upload { display: none; }

.upload-label {
    display: inline-block;
    padding: 12px 28px;
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 1px;
    border: 2px solid rgba(120, 60, 20, .2);
    transition: transform .2s, box-shadow .25s;
}

.upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(217, 119, 6, .5);
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
    .difficulty-btn { padding: 12px 16px; gap: 12px; }
    .diff-icon { font-size: 1.6em; }
    .diff-name { font-size: 1.1em; letter-spacing: 2px; }
    .diff-desc { font-size: .7em; }
    .diff-badge { font-size: .65em; padding: 3px 8px; }
    .image-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
    .image-item { height: 90px; }
}