:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --light-color: #f9f9f9;
    --border-color: #eaeaea;
    --text-color: #333;
    --text-light: #7f8c8d;
    --light-bg: #f8f9fa;
}

/* 语法列表布局 */
.grammar-list {

    gap: 15px;
    margin-bottom: 20px;
}

/* 语法卡片样式 */
.grammar-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.card-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.card-level {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.card-body {
    padding: 10px;
}

.card-footer {
    background: var(--light-bg);
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
}

/* 语法部分样式 */
.gram-section {
    margin-bottom: 24px;
}

.gram-section-title {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

/* 语法模式容器 */
.pattern-container {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    line-height: 1.5;
    border-left: 4px solid var(--secondary-color);
}

/* 语法槽位样式 */
.slot {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    margin: 0 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: rgba(52, 152, 219, 0.15);
    color: var(--secondary-color);
    border: 1px dashed var(--secondary-color);
}

.slot:hover {
    background-color: rgba(52, 152, 219, 0.25);
    transform: translateY(-1px);
}

.fixed-word {
    display: inline-block;
    margin: 0 2px;
    color: var(--text-color);
}

/* 示例容器 */
.example-container {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #27ae60;
}

.example-en {
    font-style: italic;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.example-cn {
    color: var(--text-light);
}

/* 变体和约束列表 */
.variants-list,
.constraints-list {
    padding-left: 20px;
}

.variants-list li,
.constraints-list li {
    margin-bottom: 8px;
}

/* 约束容器 */
.constraints-container {
    background: #fff3cd;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #ffc107;
    font-size: 0.9rem;
    color: #856404;
}

/* 工具提示样式 */
.slot-tooltip {
    position: fixed;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 300px;
    font-size: 0.9rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
}

.slot-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.tooltip-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.tooltip-slot {
    font-weight: bold;
    margin-right: 8px;
    color: var(--secondary-color);
}

.tooltip-role {
    color: var(--text-light);
    font-size: 0.85rem;
}

.tooltip-pos {
    margin-top: 6px;
}

.tooltip-pos-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.tooltip-pos-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tooltip-pos-tag {
    background: var(--light-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .grammar-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .grammar-card {
        margin-bottom: 20px;
    }
    
    .card-header {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-title {
        font-size: 1.1rem;
        font-weight: 400;
        margin: 0;
    }
    
    .card-level {
        align-self: flex-end;
        margin-top: 8px;
    }
    
    .pattern-container {
        padding: 12px;
        font-size: 0.8rem;
        line-height: 1.5;
    }
    
    .variants-list,
    .constraints-list {
        font-size: small;
        padding-left: 10px;
    }
    
    .variants-list li,
    .constraints-list li {
        margin-bottom: 8px;
    }
    
    .card-footer {
        padding: 10px 10px;
        font-size: 0.7rem;
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
    
    .gram-section {
        margin-bottom: 20px;
    }
    
    .gram-section-title {
        font-size: 1rem;
    }
    
    .example-en {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .card-header {
        padding: 12px;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .pattern-container {
        padding: 10px;
        font-size: 0.75rem;
    }
    
    .slot {
        padding: 1px 4px;
        font-size: 0.9em;
    }
    
    .example-container {
        padding: 12px;
    }
    
    .constraints-container {
        padding: 12px;
        font-size: 0.8rem;
    }
}

/* 桌面端调整 */
@media (min-width: 768px) {
    .grammar-list {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .card-header {
        padding: 20px;
    }
    
    .card-title {
        font-size: 1.4rem;
    }
    
    .pattern-container {
        padding: 15px;
        font-size: 1.1rem;
    }
    
    .card-footer {
        padding: 15px 20px;
        font-size: 0.9rem;
    }
}