html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}
.container {
  width: 100%;
  max-width: 100vw;
  margin: 0 auto;
  padding: 0;
}
.game-board {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  box-sizing: border-box;
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ef 100%);
}
.game-grid {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* 行样式 */
.row {
    display: flex;
    gap: 2px;
    min-height: 40px;
}

/* 第0层特殊样式（提示层） */
.row-0 {
    background: linear-gradient(135deg, #ffecd2, #fcb69f);
    border-radius: 8px;
    padding: 5px;
    border: 2px dashed #ff6b6b;
    opacity: 0.8;
    position: relative;
    /* cursor: not-allowed; */
}

.row-0::before {
    content: "提示层 - 下次生成模块";
    position: absolute;
    bottom: -25px;
    left: 10px;
    background: #ff6b6b;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.row-0 .cell {
    cursor: pointer;
    opacity: 1;
}

.row-0 .cell:hover {
    background: #ffecd2;
    border-color: #ff6b6b;
    transform: none;
}

/* 单元格样式 */
.cell {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid #e2e8f0;
    border-radius: 2px;
    background: #f7fafc;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-sizing: border-box;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
}


/* .cell.occupied {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #4c51bf;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    pointer-events: none;
} */

/* .cell.selected {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    border-color: #e53e3e;
    box-shadow: 0 0 15px rgba(240, 147, 251, 0.6);
    animation: pulse 1s infinite;
} */

/* 模块样式 */
.module {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 2px;
    cursor: move;
    user-select: none;
    transition: all 0.3s ease;
    z-index: 10;
    height: 40px;
    width: 40px;
    pointer-events: auto;
}

.module:hover {
    transform: scale(1.02);
    z-index: 10;
}

.module.dragging {
    opacity: 0.7;
    z-index: 1000;
    box-shadow: 0 0 20px #48bb78;
}

.module.valid-drop {
    outline: 2px solid rgba(72, 187, 120, 0.8);
    z-index: 10;
}

.module.invalid-drop {
    outline: 2px solid rgba(245, 101, 101, 0.8);
    z-index: 10;
}

/* 高亮和红框样式 */
.cell.highlight {
  border: 2px solid #ff9800 !important;
  background: #fffbe6 !important;
}
.cell.invalid-placement {
  border: 2px solid #e53e3e !important;
  background: #ffeaea !important;
}


/* 动画效果 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 15px rgba(240, 147, 251, 0.6);
    }
    50% {
        box-shadow: 0 0 25px rgba(240, 147, 251, 0.8);
    }
    100% {
        box-shadow: 0 0 15px rgba(240, 147, 251, 0.6);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 消除效果 */
.row.eliminating {
    animation: fadeOut 0.5s ease-out forwards;
}

.module.eliminating {
    animation: fadeOut 0.3s ease-out forwards;
}

/* 野牛模块样式 */
.module.bison {
    background: linear-gradient(135deg, #8B4513, #D2691E);
    border: 2px solid #A0522D;
    box-shadow: 0 0 10px rgba(139, 69, 19, 0.5);
    position: relative;
}

.module.bison::before {
    content: "🐂";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    z-index: 1;
}

.module.bison:hover {
    box-shadow: 0 0 15px rgba(139, 69, 19, 0.8);
}

/* 下落效果 */
.module.falling {
    animation: slideDown 0.3s ease-out;
}

/* 拖拽相关样式 */
.drag-overlay {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-board {
        min-width: 100%;
        max-width: 400px;
        padding: 15px;
    }
    
    .cell {
        width: 30px;
        height: 30px;
    }
    
    /* .module.size-1 {
        width: 20px;
        height: 15px;
    }
    
    .module.size-2 {
        width: 35px;
        height: 15px;
    }
    
    .module.size-3 {
        width: 50px;
        height: 15px;
    }
    
    .module.size-4 {
        width: 65px;
        height: 15px;
    }
    
    .module.size-5 {
        width: 80px;
        height: 15px;
    } */
    
    .module-content {
        font-size: 0.7rem;
    }
}

/* 游戏状态指示器 */
.game-status {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.status-playing {
    color: #48bb78;
}

.status-paused {
    color: #ed8936;
}

.status-gameover {
    color: #e53e3e;
}

/* AI分析结果框选样式 */
.module.ai-suggested {
    outline: 2px dashed #ff6b35;
    outline-offset: 2px;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.4);
    animation: aiPulse 2s infinite;
}

/* AI分析大框样式 */
.ai-suggestion-overlay {
    position: absolute;
    border: 4px solid #ff6b35;
    border-radius: 8px;
    pointer-events: none;
    z-index: 9999;
    box-sizing: border-box;
    animation: aiPulse 2s infinite;
    background: rgba(255, 107, 53, 0.1);
}

.module.ai-target {
    outline: 3px solid #48bb78;
    outline-offset: 2px;
    box-shadow: 0 0 15px rgba(72, 187, 120, 0.6);
    animation: aiTargetPulse 2s infinite;
}

.cell.ai-suggested-cell {
    background: rgba(255, 107, 53, 0.2) !important;
    border: 2px dashed #ff6b35 !important;
}

.cell.ai-target-cell {
    background: transparent !important;
    border: 2px solid #ff6b35 !important;
    position: relative;
    z-index: 9999;
}

/* AI框选动画 */
@keyframes aiPulse {
    0% {
        outline-color: #ff6b35;
        border-color: #ff6b35;
        box-shadow: 0 0 15px rgba(255, 107, 53, 0.6);
    }
    50% {
        outline-color: #ff8c42;
        border-color: #ff8c42;
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.8);
    }
    100% {
        outline-color: #ff6b35;
        border-color: #ff6b35;
        box-shadow: 0 0 15px rgba(255, 107, 53, 0.6);
    }
}

@keyframes aiTargetPulse {
    0% {
        outline-color: #48bb78;
        box-shadow: 0 0 15px rgba(72, 187, 120, 0.6);
    }
    50% {
        outline-color: #38a169;
        box-shadow: 0 0 20px rgba(72, 187, 120, 0.8);
    }
    100% {
        outline-color: #48bb78;
        box-shadow: 0 0 15px rgba(72, 187, 120, 0.6);
    }
}

/* 响应式布局优化：仅适配手机和平板，PC端保持原样 */

/* PC端默认样式（大于900px） */
@media (min-width: 901px) {
  .game-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    justify-content: center;
  }
  .game-board {
    width: 420px;
    max-width: 420px;
    margin: 0;
    box-sizing: border-box;
    flex-shrink: 0;
  }
  .control-panel {
    width: 400px;
    max-width: 400px;
    margin: 0;
    box-sizing: border-box;
    flex-shrink: 0;
  }
  .game-grid {
    width: 100%;
    aspect-ratio: 9 / 12;
    border-radius: 10px;
  }
  .cell {
    aspect-ratio: 1;
    min-height: 0;
  }
  .action-btn, .module-btn {
    font-size: 1em;
    padding: 0.5em 1em;
    min-width: 2.5em;
  }
  .hint-panel {
    font-size: 1em;
    padding: 0.5em 0.2em;
  }
}

/* 手机端优化 */
@media (max-width: 600px) {
  .game-board, .control-panel {
    max-width: 90vw;
    width: 90vw;
    padding: 0 10px;
    margin: 0 auto;
  }
  .game-container {
    gap: 0px;
  }
  .game-grid {
    border-radius: 8px;
    width: 100%;
    aspect-ratio: 9 / 12;
    max-width: 350px;
    margin: 0 auto;
  }
  .row {
    gap: 1px;
    min-height: 30px;
  }
  .cell {
    aspect-ratio: 1;
    min-height: 30px;
  }
  .action-btn, .module-btn {
    font-size: 0.9em;
    padding: 0.3em 0.6em;
    min-width: 1.8em;
  }
  .hint-panel {
    font-size: 0.9em;
  }
}

/* 平板端优化 */
@media (min-width: 601px) and (max-width: 900px) {
  .game-board, .control-panel {
    max-width: 90vw;
    width: 90vw;
  }
  .game-grid {
    width: 100%;
    aspect-ratio: 9 / 12;
    max-width: 500px;
    margin: 0 auto;
  }
  .cell {
    aspect-ratio: 1;
    min-height: 0;
  }
  .action-btn, .module-btn {
    font-size: 1em;
  }
}
