/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif SC', 'Noto Sans JP', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    background-image: linear-gradient(135deg, #f5f7fa 0%, #e4eaf0 100%);
    min-height: 100vh;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    animation: fadeIn 0.6s ease-in-out;
}

/* 标题样式 */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    font-weight: 400;
}

/* 主内容区域 */
.main-content {
    background-color: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* 区块标题 */
.section-title {
    font-size: clamp(1.5rem, 3vw, 2rem); /* 使用clamp函数实现响应式字体大小 */
    font-weight: 600;
    color: #495057;
    margin: 0 0 1rem 0;
    text-align: left;
    position: relative;
}

/* 选择计数文本 */
#selectionCount {
    font-size: clamp(0.9em, 2vw, 1em); /* 相对于父元素的响应式大小 */
    margin-left: 0.5rem;
    font-weight: 400;
    color: #666;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.action-button.small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* 切换按钮样式 */
.toggle-button {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* 切换按钮未选中状态 */
.toggle-button:not(.toggled) {
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.toggle-button:not(.toggled):hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    color: #165DFF; /* 深蓝色字体 */
    transition: all 0.3s ease;
}

/* 切换按钮选中状态 */
.toggle-button.toggled {
    background-color: #4facfe;
    color: white;
    border-color: #3a9bef;
    box-shadow: none;
    border-radius: 14px;
}

.toggle-button.toggled:hover {
    background-color: #3a9bef;
    box-shadow: none;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 1.5px;
}

/* 假名类型选择区域 */
.section-type-selection {
    margin-bottom: 2.5rem;
}

.type-selection {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
}

/* 假名类型卡片 */
.type-card {
    position: relative;
    cursor: pointer;
    padding: 1rem 1.5rem;
    background-color: white;
    color: #333;
    border-radius: 14px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    flex: 1 0 auto;
    min-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

/* 类型卡片悬停效果 - 与按钮保持一致 */
.type-card:hover:not(.selected) {
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: none;
    box-shadow: none;
    color: #165DFF; /* 深蓝色字体 */
    transition: all 0.3s ease;
}

/* 类型卡片选中效果 */
.type-card.selected {
    background-color: #4facfe;
    color: white;
    border-color: #3a9bef;
    box-shadow: none;
    transition: all 0.3s ease;
}

/* 隐藏复选框 */
.type-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* 类型卡片标签 */
.type-label {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: color 0.3s ease;
}

/* 标记图标 - 显示假名示例 */
.type-label .kana-marker {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.25rem;
    font-weight: bold;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

/* 选中状态下的假名标记样式 */
.type-card.selected .kana-marker {
    opacity: 1;
    color: white;
}

/* 假名选择区域 */
.section-kana-selection {
    margin-bottom: 2.5rem;
}

/* 假名选择主容器 */
.kana-selection-container {
    display: flex;
    flex-direction: column;
    gap: 0.7rem; /* 进一步减小分组间距 */
}

/* 假名行容器 - 使用flex布局确保卡片平均分布 */
.kana-grid {
    display: flex;
    justify-content: space-between;
    flex-wrap: nowrap; /* 强制不换行 */
    gap: 0.4rem; /* 减小间距 */
    margin-bottom: 1.2rem; /* 减小底部间距 */
    overflow-x: auto; /* 允许在极小屏幕上横向滚动 */
    -webkit-overflow-scrolling: touch;
}

/* 假名卡片样式 */
.kana-card {
    background-color: white;
    border-radius: 14px;
    padding: 0.6rem 0.4rem; /* 减小内边距 */
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e9ecef;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 70px; /* 减小最小高度 */
    flex: 1;
    min-width: calc(18% - 0.32rem); /* 缩小宽度以适应 */
    box-sizing: border-box;
    max-width: 90px; /* 减小最大宽度 */
    box-shadow: none;
}

/* 卡片悬停效果 - 与按钮保持一致 */
.kana-card:hover:not(.selected) {
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: none;
    box-shadow: none;
    color: #165DFF; /* 深蓝色字体 */
    transition: all 0.3s ease;
}

/* 增强选中状态的高亮效果 */
.kana-card.selected {
    background-color: #4facfe;
    color: white;
    border-color: #3a9bef;
    box-shadow: none;
    transition: all 0.3s ease;
}

/* 假名字符样式 */
.kana-character {
    font-size: clamp(1.8rem, 5vw, 2.5rem); /* 使用clamp函数实现响应式字体大小 */
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 500;
    margin-bottom: 0.2rem;
    transition: all 0.3s ease;
    white-space: nowrap; /* 防止文本换行 */
}

/* 响应式设计 - 假名字符和卡片适配不同屏幕宽度，确保每行最多显示5个假名 */
@media (max-width: 768px) {
    /* 调整标题和计数文本大小，确保同步缩放 */
    .section-title {
        font-size: clamp(1.2rem, 4vw, 1.5rem);
    }
    
    #selectionCount {
        font-size: clamp(0.8em, 3vw, 0.9em);
    }
    
    .kana-character {
        font-size: clamp(1rem, 6vw, 1.2rem);
    }
    
    .kana-card {
        min-width: calc(18% - 0.32rem);
        padding: 0.6rem 0.3rem;
    }
    
    .kana-romanization {
        font-size: 0.7rem;
    }
}

@media (max-width: 640px) {
    /* 进一步缩小标题和计数文本 */
    .section-title {
        font-size: clamp(1.1rem, 5vw, 1.3rem);
    }
    
    #selectionCount {
        font-size: clamp(0.75em, 3vw, 0.85em);
    }
    
    .kana-character {
        font-size: clamp(0.9rem, 6vw, 1.1rem);
    }
    
    .kana-card {
        min-width: calc(18% - 0.32rem);
        padding: 0.5rem 0.3rem;
        min-height: 70px;
    }
    
    .kana-romanization {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    /* 小屏幕下的标题和计数文本 */
    .section-title {
        font-size: clamp(1rem, 5vw, 1.2rem);
    }
    
    #selectionCount {
        font-size: clamp(0.7em, 3vw, 0.8em);
    }
    
    .kana-character {
        font-size: clamp(0.8rem, 7vw, 1rem);
    }
    
    .kana-card {
        min-width: calc(18% - 0.32rem);
        padding: 0.4rem 0.2rem;
        min-height: 65px;
    }
    
    .kana-romanization {
        font-size: 0.6rem;
    }
}

@media (max-width: 360px) {
    /* 最小屏幕下的标题和计数文本 */
    .section-title {
        font-size: clamp(0.9rem, 6vw, 1.1rem);
    }
    
    #selectionCount {
        font-size: clamp(0.65em, 3vw, 0.75em);
    }
    
    .kana-character {
        font-size: clamp(0.7rem, 7vw, 0.9rem);
    }
    
    .kana-card {
        min-width: calc(18% - 0.32rem);
        padding: 0.3rem 0.15rem;
        min-height: 55px;
    }
    
    .kana-romanization {
        font-size: 0.55rem;
    }
}

/* 罗马音样式 */
.kana-romanization {
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* 选中时的样式变化 */
.kana-card.selected .kana-character,
.kana-card.selected .kana-romanization {
    color: white;
}

/* 假名类型选择行标题 */
.kana-group {
    margin-bottom: 1rem;
}

.kana-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #e9ecef;
}

.kana-group-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.row-actions {
    display: flex;
    gap: 0.25rem;
}



/* 隐藏复选框 */
.kana-card .kana-checkbox-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* 增强选中状态的高亮效果 */
.kana-card.selected {
    background-color: #4facfe;
    color: white;
    border-color: #3a9bef;
    box-shadow: none;
    transition: all 0.3s ease;
}

/* 移除多余的悬停效果定义 */

/* 全局焦点样式 - 移除所有焦点轮廓 */
button:focus,
input[type="button"]:focus,
input[type="submit"]:focus,
input[type="reset"]:focus,
.action-button:focus,
.toggle-button:focus,
.kana-checkbox:focus + .kana-checkbox-label,
*:focus {
    outline: none;
    outline-offset: 0;
    box-shadow: none !important;
    border-color: inherit !important;
}

/* 确保在不同浏览器中一致的表现 */
button::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner {
    border: 0;
    padding: 0;
}

/* 快捷操作按钮 */
.section-quick-actions {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: center;
}

.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.action-button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #495057;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
}

/* 全局按钮悬停字体颜色效果 */
.action-button:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: none;
    box-shadow: none;
    color: #165DFF; /* 深蓝色字体 */
    transition: all 0.3s ease;
}

.action-button:active {
    transform: none;
    background-color: #e2e6ea;
}

/* 开始学习按钮 */
.section-start {
    position: fixed;
    bottom: 2rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 1000;
    padding: 0 2rem;
}

.start-button {
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    background-color: #165DFF; /* 深蓝色 */
    border: none;
    border-radius: 28px; /* 增加圆角使其更现代 */
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(22, 93, 255, 0.4); /* 深蓝色阴影 */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 200px;
    text-align: center;
}

/* 开始学习按钮悬停效果 */
.start-button:hover {
    transform: none;
    box-shadow: none;
    background-color: #0e48d1; /* 更深的蓝色 */
    color: white; /* 保持白色字体以确保在深色背景上的可读性 */
    transition: all 0.3s ease;
}

.start-button:active {
    transform: none;
    box-shadow: none;
    background-color: #0a3a97; /* 最深的蓝色 */
}

.start-button:disabled {
    background: linear-gradient(135deg, #b0bec5 0%, #cfd8dc 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 学习页面样式 */
.learning-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.learning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 1rem;
}

.back-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #495057;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-button:hover {
    background-color: #f8f9fa;
    color: #4facfe;
    transform: scale(1.1);
}

.progress {
    font-size: 1.1rem;
    color: #6c757d;
    font-weight: 500;
}

.learning-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.5rem 0 2rem;
}

.kana-display {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 2rem 0;
    margin-bottom: 3rem;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    animation: none;
}

.current-kana {
    font-size: 4rem;
    font-family: 'Noto Sans JP', sans-serif;
    color: #165DFF; /* 深蓝色文本 */
    text-shadow: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
    display: inline-block;
}

/* 响应式字体大小 - 平板 */
@media (max-width: 768px) {
    .current-kana {
        font-size: 3rem;
    }
}

/* 返回主页按钮样式 */
.back-button {
    padding: 0.5rem 1rem;
    background-color: #165DFF;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 2rem;
}

.back-button:hover {
    background-color: #0E4EB8;
}

.back-button:active {
    transform: scale(0.98);
}

/* 响应式字体大小 - 手机 */
@media (max-width: 480px) {
    .current-kana {
        font-size: 2rem;
    }
}

.input-area {
    width: 100%;
    max-width: 400px;
    margin-bottom: 2rem;
}

.roman-input {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.25rem;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.roman-input:focus {
    border-color: #4facfe;
    box-shadow: none;
    outline: none;
    border-radius: 10px;
}

.roman-input.correct {
    border-color: #28a745;
    background-color: rgba(40, 167, 69, 0.05);
}

.roman-input.incorrect {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

.feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    font-size: 1.1rem;
}

.feedback.correct {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.feedback.incorrect {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.feedback.show-answer {
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
}

.next-button-container {
    margin-top: 2rem;
}

.next-button {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.next-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
    }
    100% {
        box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .type-options {
        flex-direction: column;
        align-items: center;
    }
    
    .kana-grid {
        grid-template-columns: 1fr;
    }
    
    .kana-display {
        width: 100%;
        padding: 1.5rem 0;
        height: auto;
    }
    
    .current-kana {
        font-size: 5rem;
    }
    
    .learning-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* 隐藏类 */
.hidden {
    display: none;
}

/* 响应式设计 - 类型卡片随屏幕宽度缩小 */
@media (max-width: 768px) {
    .type-card {
        padding: 0.8rem 1.2rem;
        min-width: 130px;
    }
    
    .type-label {
        font-size: 1rem;
        gap: 0.4rem;
    }
    
    .type-label .kana-marker {
        font-size: 1.1rem;
    }
}

@media (max-width: 640px) {
    .type-card {
        padding: 0.7rem 1rem;
        min-width: 120px;
    }
    
    .type-label {
        font-size: 0.95rem;
        gap: 0.3rem;
    }
    
    .type-label .kana-marker {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .type-card {
        padding: 0.6rem 0.9rem;
        min-width: 110px;
    }
    
    .type-label {
        font-size: 0.9rem;
        gap: 0.3rem;
    }
    
    .type-label .kana-marker {
        font-size: 0.95rem;
    }
}

@media (max-width: 360px) {
    .type-card {
        padding: 0.5rem 0.8rem;
        min-width: 100px;
    }
    
    .type-label {
        font-size: 0.85rem;
        gap: 0.2rem;
    }
    
    .type-label .kana-marker {
        font-size: 0.9rem;
    }
}