* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

#game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部信息栏 */
#header {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.info-item {
    text-align: center;
}

.info-item .label {
    display: block;
    font-size: 12px;
    color: #aaa;
    margin-bottom: 5px;
}

.info-item span:last-child {
    font-size: 24px;
    font-weight: bold;
    color: #4ecca3;
}

/* 游戏主区域 */
#game-area {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

#layers-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 层样式 */
.layer {
    border-radius: 15px;
    padding: 15px;
    min-height: 100px;
    transition: all 0.3s ease;
}

.layer.odd {
    background: rgba(100, 149, 237, 0.2);
    border: 2px solid rgba(100, 149, 237, 0.5);
}

.layer.even {
    background: rgba(255, 165, 0, 0.2);
    border: 2px solid rgba(255, 165, 0, 0.5);
}

.layer.active {
    box-shadow: 0 0 20px rgba(78, 204, 163, 0.5);
}

.layer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.layer-number {
    font-size: 18px;
    font-weight: bold;
}

.layer-count {
    font-size: 14px;
    color: #aaa;
}

.layer-parity {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
}

/* 门槛显示 */
.layer-threshold {
    font-size: 12px;
    color: #ff6b6b;
    margin-left: 10px;
}

/* 数字容器 */
.numbers-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 60px;
    align-items: center;
}

/* 数字样式 */
.number {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.number:hover {
    transform: scale(1.1);
}

.number.selected {
    box-shadow: 0 0 0 3px #fff, 0 0 20px rgba(255, 255, 255, 0.5);
    transform: scale(1.15);
}

/* 质数颜色编码 */
.number.prime-small {
    background: linear-gradient(135deg, #4ecca3, #3d9e7e);
    color: #fff;
}

.number.prime-medium {
    background: linear-gradient(135deg, #5dade2, #3498db);
    color: #fff;
}

.number.prime-large {
    background: linear-gradient(135deg, #af7ac5, #9b59b6);
    color: #fff;
}

.number.prime-rare {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff;
}

.number.prime-legendary {
    background: linear-gradient(135deg, #f1c40f, #d4ac0d);
    color: #1a1a2e;
    animation: glow 2s ease-in-out infinite;
}

.number.normal {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px #f1c40f; }
    50% { box-shadow: 0 0 20px #f1c40f, 0 0 40px #f1c40f; }
}

/* 底部控制栏 */
#controls {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

#selected-info {
    text-align: center;
    margin-bottom: 15px;
    font-size: 18px;
}

#selected-numbers {
    color: #4ecca3;
    font-weight: bold;
}

#selected-sum {
    color: #f39c12;
    font-weight: bold;
    font-size: 24px;
}

#action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#btn-synthesize {
    background: linear-gradient(135deg, #4ecca3, #3d9e7e);
    color: #fff;
}

#btn-synthesize:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(78, 204, 163, 0.4);
}

#btn-discard {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
}

#btn-discard:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}

#btn-clear-layer {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff;
}

#btn-clear-layer:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(243, 156, 18, 0.4);
}

#btn-reroll {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: #fff;
}

#btn-reroll:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(155, 89, 182, 0.4);
}

/* 消息提示 */
#message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 20px 40px;
    border-radius: 10px;
    font-size: 18px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#message.show {
    opacity: 1;
}

/* 模态框 */
.hidden {
    display: none !important;
}

#game-over, #help-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    border: 2px solid rgba(78, 204, 163, 0.5);
}

.modal h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #4ecca3;
}

.modal p {
    margin: 10px 0;
    font-size: 18px;
}

.modal button {
    margin-top: 20px;
    background: linear-gradient(135deg, #4ecca3, #3d9e7e);
    color: #fff;
}

.rules-content {
    text-align: left;
    margin: 20px 0;
}

.rules-content p {
    margin: 15px 0;
    font-size: 16px;
    line-height: 1.6;
}

/* 帮助按钮 */
.floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5dade2, #3498db);
    color: #fff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(93, 173, 226, 0.4);
}

.floating-btn:hover {
    transform: scale(1.1);
}

/* 动画效果 */
@keyframes ascend {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-30px) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-60px) scale(0.8);
        opacity: 0;
    }
}

.number.ascending {
    animation: ascend 0.6s ease-out forwards;
}

@keyframes merge {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

.number.merging {
    animation: merge 0.3s ease-out;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(78, 204, 163, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(78, 204, 163, 0.8);
}

/* 教程样式 */
#tutorial-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.tutorial-modal {
    max-width: 600px;
    width: 90%;
    position: relative;
    z-index: 2001;
}

#tutorial-content {
    text-align: left;
    margin: 20px 0;
    line-height: 1.8;
}

#tutorial-content h3 {
    color: #4ecca3;
    margin: 15px 0 10px 0;
    font-size: 20px;
}

#tutorial-content p {
    margin: 10px 0;
    font-size: 16px;
}

#tutorial-content .highlight {
    color: #f39c12;
    font-weight: bold;
}

#tutorial-content .example {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #4ecca3;
}

#tutorial-content .tip {
    background: rgba(243, 156, 18, 0.2);
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #f39c12;
}

.tutorial-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

#btn-tutorial-skip {
    background: rgba(255, 255, 255, 0.2);
}

#btn-tutorial-finish {
    background: linear-gradient(135deg, #4ecca3, #3d9e7e);
}

/* 教程遮罩层 */
#tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1999;
}

/* 高亮指示器 */
#tutorial-highlight {
    position: absolute;
    border: 3px solid #f39c12;
    border-radius: 10px;
    box-shadow: 0 0 20px #f39c12, inset 0 0 20px rgba(243, 156, 18, 0.3);
    z-index: 1600;
    pointer-events: none;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px #f39c12, inset 0 0 20px rgba(243, 156, 18, 0.3);
    }
    50% {
        box-shadow: 0 0 40px #f39c12, inset 0 0 30px rgba(243, 156, 18, 0.5);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    #header {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .info-item {
        flex: 1;
        min-width: 80px;
    }
    
    .number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    button {
        padding: 10px 16px;
        font-size: 14px;
    }
}
