/* CountryMatrix.css */
.cm-outer-container {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    padding: 20px 32px 20px 20px;
    width: 100%;
    margin-left: 8px;
}

.cm-main-viewport {
    flex: 1;
    min-width: 0;
    width: auto;
    overflow: visible;
}

.cm-main-viewport::-webkit-scrollbar {
    display: none;
}

.cm-main-viewport {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Loading state */
.cm-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
    color: #64748b;
    font-size: 14px;
}

.cm-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #ef4444;
    border-radius: 50%;
    animation: cm-spin 0.8s linear infinite;
}

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

/* 模块标签 */
.cm-module-tag {
    display: inline-block;
    color: white;
    font-size: 13px;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    background: #ef4444;
}

/* 3列网格 */
.cm-matrix-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 18px;
    margin-bottom: 32px;
    justify-items: start;
}

/* 国家卡片设计：3列布局 - 国家/人/语言 */
.cm-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 11px 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.cm-card:hover {
    border-color: #ef4444;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.cm-active {
    background-color: #fff1f2;
    border: 2px solid #ef4444 !important;
}

/* 特殊卡片（外国）背景色 */
.cm-card.cm-special {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
}

/* 文字内容容器 - 3列布局 */
.cm-text-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    width: 100%;
    margin-left: -6px;
}

/* 每一列 */
.cm-column {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    min-width: 0;
}

/* 文字组：日文+翻译，左对齐显示 */
.cm-text-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
}

/* 分隔线 */
.cm-divider {
    width: 1px;
    height: 62px;
    background: linear-gradient(to bottom, transparent, #e5e7eb, transparent);
    flex-shrink: 0;
}

/* 文本排版 */
.cm-word {
    font-size: 18px;
    font-weight: normal;
    color: #1e293b;
    display: block;
    line-height: 1.4;
    text-align: left;
}

.cm-word ruby {
    ruby-position: over;
}

.cm-word rt {
    font-size: 0.625em;
    color: #64748b;
    font-weight: normal;
    padding-bottom: 2px;
}

.cm-meaning {
    display: block;
    font-size: 13px;
    color: #64748b;
    line-height: 1.3;
    text-align: left;
}

/* 播放图标：独立在右侧 */
.cm-icon-word {
    width: 20px;
    height: 20px;
    color: #cbd5e1;
    transition: color 0.2s;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 4px;
    align-self: flex-start;
    margin-top: 6px;
}

.cm-icon-word:hover {
    color: #ef4444;
}

/* 右侧广告位 (300*600)：顶边贴二级导航下分割线、右边贴页面右边缘
   （负 margin 抵消外层容器 padding，尺寸允许与其他模块不一致） */
.cm-ad-sidebar {
    box-sizing: border-box;
    width: 320px;
    padding-left: 20px;
    flex-shrink: 0;
    margin-top: -20px;
    margin-right: -32px;
}

.cm-ad-sticky {
    width: 300px;
    height: 600px;
    position: sticky;
    top: 0; /* 滚动时粘在滚动区顶沿（即分割线位置） */
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder-300 {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 14px;
    text-align: center;
}

/* 横幅广告栏：位于内容底部 */
.cm-bottom-banner-ad {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
    margin-top: 32px;
    display: flex;
    justify-content: center;
}

.cm-bottom-banner-ad .banner-ad-content {
    display: flex;
    align-items: center;
    max-width: 800px;
    margin-left: 0;
    margin-right: 0;
    padding: 0 16px;
    height: 70px;
    gap: 12px;
}
