/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    overflow-x: hidden; /* 防止水平滚动 */
    width: 100%;
    max-width: 100vw;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%; /* 让容器占满父元素高度 */
}

/* 在hero部分中，让container成为flex容器 */
.hero .container {
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* 让内容靠底部对齐 */
    height: 100%;
}

/* Header Styles */
.header {
    background-color: #600000;
    color: white;
    padding: 0.75rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding-right: 120px; /* Add space for the fixed language selector */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (min-width: 769px) {
    .header {
        position: relative;
    }

    .header-content {
        justify-content: center;
        position: relative;
    }

    .logo {
        position: absolute;
        left: 20px;
        z-index: 1002;
    }

    .language-selector-fixed {
        position: absolute;
        right: 20px;
        z-index: 1002;
    }

    .nav {
        display: flex;
        justify-content: center;
        width: 100%;
        max-width: calc(1200px - 240px); /* 考虑左右各120px的空间 */
        margin: 0 auto;
    }

    .nav-list {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.4rem 0;
        padding-right: 10px;
    }

    .header-content {
        align-items: flex-start;
        gap: 0.5rem;
    }

    .logo img {
        height: 32px;
        width: auto;
    }

    .language-selector-fixed {
        top: 12px;
        padding: 0.25rem;
        font-size: 12px;
    }
}

.logo img {
    height: 50px;
    width: auto;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 1rem;
    flex-wrap: nowrap;
    justify-content: center;
    padding: 0;
}

/* 在窄屏下，让导航按钮自动缩小以适应一行 */
@media (max-width: 768px) {
    .nav-list {
        flex-wrap: nowrap;
        justify-content: center;
        overflow-x: hidden;
        gap: 0.5rem;
        padding: 4px 0;
    }

    .nav-list a {
        padding: 6px 8px;
        font-size: 11px;
    }
}

.nav-list a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 10px 16px;
}

.nav-list a:hover {
    color: #FF6B35;
}

.language-selector select {
    background-color: #333;
    color: white;
    border: 1px solid #555;
    padding: 0.5rem;
    border-radius: 4px;
}

.language-selector-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background-color: #333;
    padding: 0.5rem;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.language-selector-fixed select {
    background-color: #333;
    color: white;
    border: none;
    padding: 0.25rem;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

/* Hero Section */
.hero {
    margin-top: 0px; /* 减少顶部边距以减少空隙 */
    background: url('../images/banner.webp') no-repeat center center;
    background-size: cover;
    color: white;
    padding: 6rem 0; /* 增加内边距以提高高度 */
    position: relative; /* 为内容添加相对定位 */
    min-height: 500px; /* 设置最小高度以确保足够的展示空间 */
    display: flex; /* 使用flexbox布局 */
    align-items: flex-end; /* 垂直靠下，使内容紧贴底部 */
    justify-content: center; /* 水平居中 */
}

.hero-content {
    display: flex;
    align-items: center; /* 保持内容项垂直居中 */
    justify-content: center; /* 水平居中 */
    gap: 3rem;
    padding-bottom: 3rem; /* 添加底部内边距以留出空间 */
}

.hero-image {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 10px;
}

.hero-text {
    text-align: center; /* 水平居中所有内联内容 */
}

.hero-text h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #FF6B35;
    background-color: rgba(0, 0, 0, 0.5); /* 半透明灰色背景 */
    padding: 0.5rem 1rem; /* 添加内边距 */
    border-radius: 5px; /* 添加圆角 */
    display: inline-block; /* 使背景仅包围文字 */
}

.hero-text p {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 200px; /* 设置最小宽度 */
}

/* App Store Button Style */
.btn-appstore {
    background: linear-gradient(to bottom, #0081ff, #0062cc);
    color: white;
    border: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 1rem 2rem; /* 确保内边距一致 */
    border-radius: 50px; /* 确保圆角一致 */
    font-weight: bold;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block; /* 确保显示类型一致 */
}

.btn-appstore:hover {
    background: linear-gradient(to bottom, #006eff, #0069e0);
    transform: translateY(-2px);
}

/* Google Play Button Style */
.btn-googleplay {
    background: linear-gradient(to bottom, #00c45c, #00a84c);
    color: white;
    border: none;
    font-family: 'Roboto', Arial, sans-serif;
    padding: 1rem 2rem; /* 确保内边距一致 */
    border-radius: 50px; /* 确保圆角一致 */
    font-weight: bold;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block; /* 确保显示类型一致 */
}

.btn-googleplay:hover {
    background: linear-gradient(to bottom, #00d460, #00b850);
    transform: translateY(-2px);
}

.store-badge {
  height: 60px;          /* 统一高度 */
  width: auto;           /* 保持宽高比 */
  max-width: 200px;      /* 设置最大宽度 */
  display: block;        /* 确保图片正确显示 */
  margin: 0 auto;        /* 居中显示 */
}

.download-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.download-buttons .btn {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex: 1;
}

/* Section Styles */
.section {
    padding: 4rem 0;
    background-color: #f8f9fa;
}

.section:nth-child(even) {
    background-color: white;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: #2D3748;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background-color: #FF6B35;
    margin: 1rem auto;
}

/* Strategy Section */
.strategy-content {
    display: flex;
    justify-content: center;
}

.strategy-item {
    text-align: center;
    max-width: 400px;
}

.strategy-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* Introduction Section */
.intro-text {
    font-size: 1.2rem;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

/* Milestone Section */
.milestone-timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.milestone-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #FF6B35;
    transform: translateX(-50%);
}

.milestone-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
}

.milestone-item:nth-child(even) {
    flex-direction: row-reverse;
}

.milestone-date {
    background-color: #FF6B35;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    min-width: 120px;
    text-align: center;
}

.milestone-content {
    background-color: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-width: 400px;
    margin: 0 2rem;
    box-sizing: border-box;
}

/* Characters Section */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.character-item {
    background-color: white;
    padding: 1.2rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.character-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

.character-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.character-item:hover .character-image {
    transform: scale(1.05);
}

.character-item h3 {
    color: #2D3748;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.character-item p {
    color: #4A5568;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.8rem;
}

.character-role {
    display: inline-block;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: absolute;
    top: 10px;
    right: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.feature-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* Event Section */
.event-content {
    display: flex;
    justify-content: center;
}

.event-item {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-width: 500px;
    text-align: center;
}

.event-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.event-date {
    color: #FF6B35;
    font-weight: bold;
}

/* Chapters Section */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 始终显示3列 */
    gap: 1rem; /* 减小间隙 */
    max-width: 1200px;
    margin: 0 auto;
}

/* 在窄屏下，减少网格间隙以确保章节项为正方形 */
@media (max-width: 768px) {
    .chapters-grid {
        gap: 0; /* 移除间隙以确保正方形比例 */
    }
}

.chapter-item {
    background-color: white;
    padding: 1.2rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.chapter-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

.chapter-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.chapter-item:hover .chapter-image {
    transform: scale(1.05);
}

.chapter-item h3 {
    color: #2D3748;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.chapter-item p {
    color: #4A5568;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.8rem;
}

/* 在窄屏下，章节项只显示图片并为正方形 */
@media (max-width: 768px) {
    .chapters-grid {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }

    .chapter-item {
        padding: 0; /* 移除内边距 */
        width: calc(100% / 3); /* 每行3个，精确计算 */
        aspect-ratio: 1 / 1; /* 保持正方形比例 - 现代浏览器支持 */
        position: relative;
        /* 确保没有额外的边距 */
        margin: 0;
        flex: none; /* 确保不被flex属性影响 */
        box-sizing: border-box; /* 确保padding和border包含在宽度内 */
    }

    .chapter-item > div {
        display: none; /* 隐藏文字内容 */
    }

    .chapter-image {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover; /* 图片填充整个容器 */
        border-radius: 0; /* 移除圆角以完全填充 */
        margin-bottom: 0;
    }
}

/* 在窄屏下隐藏特定章节描述 */
@media (max-width: 768px) {
    .chapter-item p[data-lang-key="chapter-hashira-meeting-desc"] {
        display: none;
    }
}

/* Download Section */
.download-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
    flex-wrap: wrap; /* 允许换行 */
}

.download-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.download-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.download-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    background-color: #600000;
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.social-links {
    display: flex;
    gap: 2rem;
}

.social-links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: #FF6B35;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .nav {
        width: 100%; /* 使用容器宽度确保占满一行 */
        order: 2; /* 让nav在logo下方显示 */
    }

    .logo {
        order: 1; /* 让logo在nav上方显示 */
    }

    .language-selector-fixed {
        order: 3; /* 让语言选择器在nav下方显示 */
    }

    .nav-list {
        gap: 0.1rem; /* 进一步减小间隙 */
        flex-wrap: nowrap;
        justify-content: space-between; /* 改为两端对齐，使按钮分散填充整个宽度 */
        padding: 5px 0;
        width: 100%;
        overflow-x: hidden;
        flex: 1; /* 让nav-list占据可用空间 */
    }

    .nav-list a {
        white-space: nowrap;
        font-size: 0.65rem; /* 进一步减小字体 */
        padding: 0.15rem 0.2rem; /* 进一步减小内边距 */
        flex: 1; /* 平均分配空间 */
        text-align: center;
        min-width: 0;
        flex-basis: 0; /* 让flex项目根据可用空间收缩 */
        overflow: hidden;
        text-overflow: ellipsis; /* 如果文字太长则省略 */
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
        align-items: center; /* 水平居中 */
        padding-bottom: 2rem; /* 调整底部内边距 */
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .hero-text p {
        font-size: 1.2rem;
    }

    .milestone-item {
        flex-direction: column !important;
        text-align: center;
    }

    .milestone-content {
        margin: 1rem 0;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }

    .social-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .section {
        padding: 2rem 0;
    }

    .section-title {
        font-size: 2rem;
    }

    .characters-grid {
        grid-template-columns: repeat(3, 1fr); /* 改为3列以适应窄屏 */
        gap: 0.25rem;
    }

    .character-item {
        padding: 0.25rem;
    }

    .character-image {
        height: 60px;
        margin-bottom: 0;
    }

    .character-item h3,
    .character-item p,
    .character-role {
        display: none;
    }

    .character-role {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
    }

    .download-options {
        flex-direction: row;
        flex-wrap: wrap; /* 在极窄屏幕下允许换行 */
        justify-content: center;
    }

    .download-option {
        flex: 1; /* 让选项平均分配空间 */
        min-width: 150px; /* 设置最小宽度 */
        padding: 1.5rem; /* 减小内边距 */
    }

    .nav-list {
        gap: 0.05rem; /* 进一步减小间隙 */
    }

    .nav-list a {
        font-size: 0.55rem; /* 进一步减小字体 */
        padding: 0.1rem 0.15rem; /* 进一步减小内边距 */
        min-width: 0;
        flex-basis: 0; /* 让flex项目根据可用空间收缩 */
    }
}

/* Extra small screens (320px and below) */
@media (max-width: 320px) {
    .characters-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.2rem;
    }

    .character-item {
        padding: 0.2rem;
    }

    .character-image {
        height: 50px;
    }

    .nav-list {
        gap: 0.02rem; /* 最小间隙 */
    }

    .nav-list a {
        font-size: 0.5rem; /* 更小的字体 */
        padding: 0.08rem 0.1rem; /* 最小内边距 */
        flex-basis: 0; /* 让flex项目根据可用空间收缩 */
    }
}

/* Floating Icon Styles */
.floating-icon {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 15px;
}

.floating-icon-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: white;
    padding: 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
    min-width: 80px;
}

.floating-icon-link:hover {
    background-color: rgba(255, 107, 53, 0.2);
    transform: scale(1.05);
}

.floating-icon-image {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    margin-bottom: 6px;
    object-fit: cover;
}

.floating-icon-link span {
    font-size: 11px;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .floating-icon {
        right: 10px;
        top: 80vh;
        bottom: auto;
        transform: none;
        padding: 12px;
    }

    .floating-icon-link {
        padding: 10px;
        min-width: 70px;
    }

    .floating-icon-image {
        width: 32px;
        height: 32px;
        margin-bottom: 4px;
    }

    .floating-icon-link span {
        font-size: 11px;
    }

    .chapter-item {
        padding: 1.2rem;
    }

    .chapter-image {
        height: 150px;
    }

    .chapter-item h3 {
        font-size: 1.1rem;
    }

    .chapter-item p {
        font-size: 0.85rem;
    }
}