* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-red: #e74c3c;
    --color-gold: #f39c12;
    --color-big-gold: #d4af37;
    --color-big-red: #c0392b;
    --color-super-red: #8b0000;
    --color-primary: #3498db;
    --color-secondary: #95a5a6;
    --color-success: #27ae60;
    --color-bg: #ecf0f1;
    --color-border: #bdc3c7;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2c3e50;
}

/* 通用样式 */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: block;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-secondary.active {
    background: var(--color-success);
}

/* 登录界面 */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 20px;
}

.login-form input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.login-form button {
    width: 100%;
}

.error-message {
    color: var(--color-red);
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
}

/* 关卡选择界面 */
#levelSelectScreen {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header h2 {
    margin: 0;
}

.level-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.level-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.level-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.level-card h3 {
    margin-bottom: 10px;
    color: var(--color-primary);
}

.level-card .level-info {
    color: #7f8c8d;
    font-size: 14px;
    margin: 5px 0;
}

.level-card .difficulty {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
}

.difficulty.简单 { background: #d5f4e6; color: #27ae60; }
.difficulty.中等 { background: #ffeaa7; color: #f39c12; }
.difficulty.困难 { background: #fab1a0; color: #e74c3c; }
.difficulty.专家 { background: #dfe6e9; color: #2d3436; }

/* 游戏界面 */
.game-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    align-items: flex-start;
    margin: 0 auto;
}

/* 头部控制按钮 */
.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-controls-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 收藏品游戏配置样式 */
.collection-game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.collection-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-border);
    flex-wrap: wrap;
    gap: 15px;
}

.collection-game-header h3 {
    margin: 0;
    color: var(--color-primary);
}

.collection-game-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.game-name-input {
    width: 150px;
    padding: 5px 8px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
}

.difficulty-select {
    padding: 5px 8px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    background: white;
}

.collection-game-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 400px;
}

.game-config-info {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--color-primary);
    text-align: center;
    width: 100%;
    max-width: 600px;
}

.placed-collections {
    margin-top: 10px;
    font-weight: bold;
    color: var(--color-primary);
}

.collection-game-board {
    display: grid;
    gap: 4px;
    background: linear-gradient(145deg, #e8ecef 0%, #d5dce0 100%);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.game-cell.highlighted {
    animation: highlight 0.5s ease-in-out;
    border: 3px solid #ffd700 !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6) !important;
    transform: scale(1.05);
}

.collection-game-cell.highlighted {
    animation: pulse-highlight 1s ease-in-out infinite;
    border: 4px solid #ff6b00 !important;
    box-shadow: 
        0 0 20px rgba(255, 107, 0, 0.8),
        0 0 40px rgba(255, 107, 0, 0.5),
        inset 0 0 15px rgba(255, 215, 0, 0.3) !important;
    transform: scale(1.08);
    z-index: 10;
}

@keyframes pulse-highlight {
    0%, 100% { 
        box-shadow: 
            0 0 20px rgba(255, 107, 0, 0.8),
            0 0 40px rgba(255, 107, 0, 0.5);
        transform: scale(1.08);
    }
    50% { 
        box-shadow: 
            0 0 30px rgba(255, 107, 0, 1),
            0 0 60px rgba(255, 107, 0, 0.7);
        transform: scale(1.12);
    }
}

/* 收藏品连线游戏 - 玩家端样式 */
.collection-game-cell {
    width: var(--collection-cell-size, 90px);
    height: var(--collection-cell-size, 90px);
    min-width: 70px;
    min-height: 70px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}

.collection-game-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.collection-game-cell .cell-text {
    font-size: 12px;
    font-weight: bold;
    text-align: center;
}

.collection-game-cell.has-collection {
    border-width: 3px;
    border-color: #d0d0d0;
    background: white;
}

/* 收藏品格子内容样式 */
.collection-cell-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.collection-cell-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.collection-cell-name {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    border-radius: 6px;
}

.collection-game-cell.confirmed {
    border: 4px solid #ff0000 !important;
    box-shadow: 
        0 0 15px rgba(255, 0, 0, 0.6),
        0 0 30px rgba(255, 0, 0, 0.3) !important;
}

.collection-game-cell.confirmed::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    background: #27ae60;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* 收藏品连线游戏 - 收藏品列表样式 */
.collection-item-game {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.collection-item-game:hover {
    border-color: var(--color-primary);
    background: #f5f5f5;
}

.collection-item-game.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-light, #e3f2fd);
}

.collection-item-game.confirmed {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.collection-item-game.in-game {
    border-color: var(--color-primary);
    background: rgba(33, 150, 243, 0.05);
}

.collection-item-game.not-in-game {
    opacity: 0.5;
    border-color: #ccc;
    background: #f5f5f5;
}

.collection-item-game.not-in-game:hover {
    opacity: 0.7;
}

.collection-image-small {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    margin-right: 10px;
    border-radius: 4px;
    overflow: hidden;
}

.collection-image-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image-small {
    width: 100%;
    height: 100%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #666;
}

.collection-info-game {
    flex: 1;
    min-width: 0;
}

.collection-name-game {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collection-attr-game {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.btn-confirm-collection {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    background: var(--color-primary);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
}

.btn-confirm-collection:hover {
    background: var(--color-primary-dark, #1976d2);
}

.btn-confirm-collection.confirmed {
    background: #27ae60;
}

@keyframes highlight {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* 拖拽样式 */
.collection-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.collection-game-cell.drag-over {
    background-color: var(--color-primary)20;
    border-color: var(--color-primary);
    transform: scale(1.1);
}

/* 拖拽时的自定义光标 */
body.dragging {
    cursor: grabbing !important;
}

/* 收藏品面板 */
.collections-panel {
    flex: 0 0 300px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.collections-panel h3 {
    margin-bottom: 10px;
}

.help-text {
    font-size: 12px;
    color: #7f8c8d;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 3px solid var(--color-primary);
}

/* 搜索栏样式 */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.attribute-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.filter-btn {
    padding: 6px 12px;
    border: 2px solid var(--color-border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--color-primary);
}

.filter-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.collections-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.collection-item {
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
    background: white;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.collection-item:hover {
    border-color: var(--color-primary);
    transform: scale(1.02);
}

.collection-item.selected {
    border-color: var(--color-success);
    background: #e8f5e9;
    box-shadow: 0 0 0 2px var(--color-success);
}

.collection-item.highlighted {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.collection-item.dragging {
    opacity: 0.3;
    cursor: grabbing;
    transform: scale(0.8);
}

/* 拖拽时的自定义光标 - 显示小预览 */
body.dragging {
    cursor: grabbing !important;
}

body.dragging * {
    cursor: grabbing !important;
}

/* 拖拽预览 - 跟随鼠标的小预览 */
.drag-preview {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.9;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--color-primary);
    min-width: 60px;
    text-align: center;
}

.drag-preview-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    transition: transform 0.3s;
}

.drag-preview-grid {
    display: inline-grid;
    gap: 2px;
    background: rgba(52, 152, 219, 0.2);
    padding: 4px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.drag-preview-cell {
    width: 20px;
    height: 20px;
    background: rgba(52, 152, 219, 0.3);
    border-radius: 2px;
    border: 1px solid rgba(52, 152, 219, 0.5);
}

.drag-preview-cell.filled {
    background: #3498db;
    border-color: #2980b9;
    box-shadow: 0 0 4px rgba(52, 152, 219, 0.6);
}

.drag-preview-name {
    font-size: 12px;
    color: var(--color-primary);
    font-weight: 600;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.collection-item .name {
    font-weight: 600;
    margin-bottom: 5px;
}

.collection-item .info {
    font-size: 12px;
    color: #7f8c8d;
}

.collection-item .attribute-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 5px;
}

.attribute-badge.红 { background: #ffebee; color: var(--color-red); }
.attribute-badge.金 { background: #fff8e1; color: var(--color-gold); }
.attribute-badge.大金 { background: #fffde7; color: var(--color-big-gold); }
.attribute-badge.大红 { background: #fce4ec; color: var(--color-big-red); }
.attribute-badge.大大红 { background: #f3e5f5; color: var(--color-super-red); }

/* 旋转控件 */
.rotation-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.rotate-btn {
    padding: 4px 10px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rotate-btn:hover {
    background: #2980b9;
    transform: rotate(90deg);
}

.rotate-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.rotation-indicator {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
    min-width: 30px;
    text-align: center;
}

/* 旋转控制面板 */
.rotation-panel {
    flex: 0 0 280px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    color: white;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.rotation-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.rotation-panel-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.rotation-controls-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
}

.btn-rotate {
    background: white;
    color: #667eea;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-rotate:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn-rotate:active {
    transform: scale(0.95);
}

.rotation-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.rotation-preview {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 10px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.rotation-preview .preview-grid {
    display: inline-grid;
    gap: 2px;
}

.rotation-preview .preview-cell {
    width: 16px;
    height: 16px;
    background: #e0e0e0;
    border-radius: 2px;
}

.rotation-preview .preview-cell.filled {
    background: #667eea;
}

.rotation-angle {
    font-size: 24px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.rotation-hint {
    text-align: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
    border-radius: 6px;
}

/* 游戏棋盘 */
.board-container {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-board {
    display: grid;
    gap: 2px;
    background: var(--color-border);
    padding: 2px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.grid-cell {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #ddd;
    position: relative;
    transition: all 0.2s;
}

.grid-cell.disabled {
    background: #34495e;
    cursor: not-allowed;
}

.grid-cell.hover {
    background: #d5f4e6;
    border: 2px solid #27ae60 !important;
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.4) !important;
    transform: scale(1.05);
    z-index: 10;
}

.grid-cell.invalid {
    background: #ffcdd2;
    border: 2px solid #e74c3c !important;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.4) !important;
    transform: scale(1.05);
    z-index: 10;
}

.grid-cell.placed {
    cursor: pointer;
}

.grid-cell.placed:hover {
    opacity: 0.8;
}

.grid-cell .cell-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 2;
}

.cell-content.cell-image {
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px;
}

.cell-content.cell-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 2px;
}

.cell-content.cell-text {
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px;
    font-size: 8px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    text-align: center;
    overflow: hidden;
    word-break: break-all;
    line-height: 1;
}

.cell-content.cell-text span {
    display: block;
    width: 100%;
    text-align: center;
}

.board-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.completion-status {
    padding: 8px 16px;
    background: var(--color-bg);
    border-radius: 6px;
    font-size: 14px;
}

/* 加载提示 */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 提示消息 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    padding: 20px 40px;
    background: #2c3e50;
    color: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    transition: transform 0.3s;
    z-index: 10000;
    text-align: center;
    font-size: 16px;
}

.toast.show {
    transform: translate(-50%, -50%) scale(1);
}

.toast.success {
    background: var(--color-success);
}

.toast.error {
    background: var(--color-red);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .collection-item {
        min-height: 60px;
        padding: 8px;
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    
    .collection-item:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    .grid-cell {
        min-height: 50px;
        touch-action: none;
        cursor: pointer;
        width: 40px;
        height: 40px;
    }
    
    .collections-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .game-board {
        gap: 1px;
        padding: 5px;
    }
    
    .board-container {
        padding: 5px;
    }
    
    /* 手机端拖拽预览样式 */
    #mobileDragPreview {
        touch-action: none;
        pointer-events: none;
    }
    
    /* 防止手机端滚动 */
    body.dragging {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    /* 手机端按钮优化 */
    .btn-primary, .btn-secondary {
        min-height: 36px;
        font-size: 14px;
        touch-action: manipulation;
        padding: 8px 12px;
    }
    
    /* 手机端收藏品信息优化 */
    .collection-info {
        font-size: 12px;
        margin-top: 4px;
    }
    
    .attribute-badge {
        font-size: 10px;
        padding: 1px 4px;
    }
    
    /* 收藏品标题优化 */
    .collection-item h4 {
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    .game-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .collections-panel {
        flex: 0 0 auto;
        width: 100%;
        max-height: 150px; /* 大幅减少收藏品面板高度 */
    }
    
    .rotation-panel {
        flex: 0 0 auto;
        width: 100%;
        padding: 10px;
        min-height: 60px; /* 减少旋转面板高度 */
    }
    
    /* 旋转按钮优化 */
    .rotation-controls {
        gap: 8px;
    }
    
    .rotation-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .rotation-info {
        font-size: 12px;
    }
    
    /* 棋盘容器优化 */
    .board-container {
        flex: 1;
        min-height: 300px; /* 确保棋盘有足够空间 */
    }
    
    .header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
    }
    
    .header h2 {
        font-size: 18px;
    }
    
    .level-list {
        grid-template-columns: 1fr;
    }
    
    /* 面板标题优化 */
    .panel-header {
        padding: 8px 12px;
        min-height: 40px;
    }
    
    .panel-header h3 {
        font-size: 14px;
    }
    
    /* 控制按钮优化 */
    .board-controls {
        padding: 8px;
        gap: 8px;
    }
    
    .completion-status {
        font-size: 12px;
    }
    
    /* 游戏区域优化 */
    .game-area {
        padding: 5px;
    }
    
    /* 可折叠面板功能 */
    .panel-collapse-btn {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.8);
        border: 1px solid #ddd;
        border-radius: 4px;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 12px;
        z-index: 10;
    }
    
    .panel-collapse-btn:hover {
        background: rgba(255, 255, 255, 1);
    }
    
    .collections-panel.collapsed {
        max-height: 40px; /* 只显示标题栏 */
        overflow: hidden;
    }
    
    .collections-panel.collapsed .collections-list {
        display: none;
    }
    
    .rotation-panel.collapsed {
        min-height: 40px; /* 只显示标题栏 */
        overflow: hidden;
    }
    
    .rotation-panel.collapsed .rotation-controls {
        display: none;
    }
    
    /* 为棋盘容器添加更多空间当面板折叠时 */
    .collections-panel.collapsed ~ .game-area .board-container {
        min-height: 400px;
    }
    
    .rotation-panel.collapsed ~ .game-area .board-container {
        min-height: 450px;
    }
}

@media (max-width: 480px) {
    .grid-cell {
        width: 25px;
        height: 25px;
    }
    
    .collections-panel {
        flex: 0 0 auto;
    }
    
    body {
        font-size: 14px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .btn-rotate {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .rotation-panel {
        padding: 15px;
    }
}

/* 玩家信息和关卡选择样式 */
.player-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.player-info h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.player-info p {
    font-size: 16px;
    opacity: 0.9;
}

.current-time {
    margin-top: 15px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.time-display {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Duplicate .collection-item styles removed - consolidated above at line 616 */

/* 简化的拖动预览样式 */
.grid-cell.hover-simple {
    background: rgba(39, 174, 96, 0.3) !important;
    border: 2px solid #27ae60 !important;
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.4) !important;
}

.grid-cell.invalid-simple {
    background: rgba(231, 76, 60, 0.3) !important;
    border: 2px solid #e74c3c !important;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.4) !important;
}

.collection-image {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 8px;
    background: var(--color-bg);
    overflow: hidden;
}

.collection-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.3s;
}

.collection-image .no-image {
    font-size: 12px;
    color: var(--color-primary);
    opacity: 1;
    font-weight: 600;
    text-align: center;
    padding: 5px;
    line-height: 1.2;
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collection-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.collection-item .name {
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 4px;
    font-size: 14px;
}

.collection-item .info {
    font-size: 12px;
    color: var(--color-secondary);
    margin-bottom: 6px;
}

.empty-levels {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.empty-levels .current-time {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-top: 20px;
}

.empty-levels .time-display {
    color: rgba(255, 255, 255, 0.95);
    font-size: 16px;
}

.empty-levels h3 {
    font-size: 24px;
    color: var(--color-primary);
    margin-bottom: 16px;
}

.empty-levels p {
    font-size: 16px;
    color: var(--color-secondary);
    line-height: 1.5;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

@media (max-width: 768px) {
    .levels-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .player-info {
        padding: 15px;
    }
    
    .player-info h3 {
        font-size: 20px;
    }
    
    .player-info p {
        font-size: 14px;
    }
}

/* ==================== 消除游戏样式 ==================== */

/* 消除游戏格子样式 */
.grid-cell.eliminate-cell {
    transition: all 0.3s ease;
}

/* 消除动画 */
.grid-cell.eliminating {
    animation: eliminate-flash 0.5s ease-in-out;
}

@keyframes eliminate-flash {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    25% {
        transform: scale(1.1);
        background: #f1c40f !important;
        box-shadow: 0 0 20px #f1c40f;
    }
    50% {
        transform: scale(1.05);
        background: #e74c3c !important;
        box-shadow: 0 0 30px #e74c3c;
    }
    75% {
        transform: scale(0.9);
        opacity: 0.5;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* 消除游戏行填满提示 */
.grid-cell.row-full {
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.8);
}

/* 消除统计样式 */
.completion-status strong {
    color: var(--color-primary);
    font-size: 1.2em;
}
