/* 基本样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 页面布局 */
header {
    background: linear-gradient(135deg, #FF4500, #FF8C00);
    color: white;
    text-align: center;
    padding: 10px 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

header:before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: calc(100% + 100px);
    height: calc(100% + 100px);
    background: url('https://www.transparenttextures.com/patterns/shattered-dark.png');
    opacity: 0.05;
    z-index: 0;
}

header h1 {
    position: relative;
    z-index: 1;
    font-size: 2.8em;
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

header .subtitle {
    position: relative;
    z-index: 1;
    font-size: 1.2em;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

footer {
    background: #222;
    color: #999;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    font-size: 0.9em;
}

/* 特色忍者区域 */
.featured-section {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25), 0 5px 15px rgba(255, 69, 0, 0.15);
    border-radius: 24px;
    text-align: center;
    z-index: 100;
    max-width: 900px;
    width: 800px;
    transition: all 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.section-title {
    font-size: 2em;
    color: #FF4500;
    margin-bottom: 10px;
    position: relative;
    display: inline-block;
}

.section-title:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 25%;
    width: 50%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #FF4500, transparent);
}

.section-desc {
    color: #666;
    margin-bottom: 30px;
    font-style: italic;
}

.featured-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: nowrap;
    margin: 0 auto;
    align-items: center;
    perspective: 1000px;
}

/* featured-card三段式优化 */
.featured-card {
    width: 240px;
    height: 410px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    box-sizing: border-box;
    border-radius: 22px;
}

.featured-image {
    flex: 0 0 220px;
    height: 220px;
    margin: 18px 18px 0 18px;
    border-radius: 22px;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: transparent;
    box-shadow: 0 6px 24px 0 rgba(255, 140, 0, 0.16), 0 2px 8px 0 rgba(0,0,0,0.10);
    border: 2.5px solid #ffe0b2;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s, border 0.3s;
}

.featured-info {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 10px 8px 0 8px; /* 原18px，缩小左右间距 */
    background: none;
}

.featured-name {
    flex: 0 0 60px;
    font-size: 1.2em; /* 稍微缩小字体，防止溢出 */
    margin-bottom: 4px; /* 原10px，缩小名称和按钮间距 */
    color: #333;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-align: center;
    width: 100%;
    line-height: 1.25;
}

.featured-level {
    flex: 0 0 36px;
    margin-top: auto;
    margin-bottom: 10px; /* 原24px，缩小与下方按钮的间距 */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px; /* 原90px，缩小宽度 */
    font-size: 0.95em; /* 稍微缩小字体 */
    padding: 3px 10px; /* 原5px 15px，缩小按钮高度和宽度 */
}

/* 保证三个卡片宽度一致 */
.featured-container {
    align-items: stretch;
}

.featured-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255, 69, 0, 0.06) 0%, rgba(255, 255, 255, 0.10) 100%);
    z-index: 0;
    pointer-events: none;
}

.featured-card:hover {
    box-shadow: 0 20px 48px 0 rgba(255, 140, 0, 0.18), 0 6px 24px 0 rgba(0,0,0,0.12);
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 60%, rgba(255, 244, 232, 0.95) 100%);
}

.featured-card:hover::before {
    opacity: 1;
    transform: scale(1.03);
    animation: none;
}

.featured-image::after {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 0; bottom: 0;
    border-radius: 18px 18px 12px 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.00) 60%, rgba(255, 140, 0, 0.10) 100%);
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.4s;
    opacity: 1;
}

.featured-card:hover .featured-image {
    transform: scale(1.045);
    box-shadow: 0 12px 32px 0 rgba(255, 140, 0, 0.22), 0 4px 16px 0 rgba(0,0,0,0.13);
    border: 2.5px solid #ffb74d;
}

.featured-card:hover .featured-image::after {
    opacity: 1;
    background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.00) 60%, rgba(255, 140, 0, 0.18) 100%);
}

.featured-info {
    padding: 18px;
    text-align: center;
    background: linear-gradient(to bottom, #ffffff, #f9f9f9);
    flex-grow: 1; /* 让信息区域填充剩余空间 */
    display: flex;
    flex-direction: column;
    justify-content: center; /* 垂直居中文字内容 */
    position: relative;
    z-index: 1;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
}

.featured-name {
    font-size: 1.4em;
    margin-bottom: 10px;
    color: #333;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* 限制最多显示3行 */
    -webkit-box-orient: vertical;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, color 0.3s ease;
}

.featured-card:hover .featured-name {
    color: #FF4500;
    transform: translateZ(5px);
}

.featured-level {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    color: white;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
    margin-top: 2px;
}

.featured-card:hover .featured-level {
    transform: translateY(-3px) translateZ(5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.featured-level::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s ease;
    z-index: -1;
}

.featured-card:hover .featured-level::before {
    left: 100%;
}

/* 控制面板 */
.controls-wrapper {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-bottom: 2px solid rgba(255, 69, 0, 0.2);
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 1000px;
    margin: 0 auto;
}

.level-filter {
    background: white;
    border: 2px solid #eee;
    border-radius: 22px;
    padding: 8px 22px;
    font-size: 16px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.level-filter:hover {
    border-color: #FF4500;
    color: #FF4500;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.15);
}

.level-filter.active {
    background: linear-gradient(135deg, #FF4500, #FF8C00);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.3);
}

.random-btn {
    background: linear-gradient(135deg, #FF4500, #FF8C00);
    color: white;
    border: none;
    border-radius: 22px;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.random-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transform: scale(0.5);
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
    z-index: -1;
    pointer-events: none;
}

.random-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(255, 69, 0, 0.3);
}

.random-btn:hover::after {
    opacity: 1;
    transform: scale(1);
}

.random-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 69, 0, 0.4);
}

.history-btn {
    background: #fff;
    color: #FF4500;
    border: 2px solid #FF4500;
    border-radius: 22px;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: bold;
    margin-left: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}
.history-btn:hover, .history-btn:focus {
    background: #FF4500;
    color: #fff;
}

/* 所有忍者展示区域 */
.all-ninjas-section {
    padding: 0;
    text-align: center;
    position: relative;
    background: linear-gradient(135deg, #f9f9f9, #f0f0f0);
    height: 600px;
    overflow: hidden;
}

.count-display {
    margin: 20px auto;
    padding: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    font-size: 0.9em;
    color: #555;
    position: relative;
    z-index: 10;
}

/* 莫比乌斯环/3D水桶效果 */
.mobius-main-container {
    position: relative;
    height: 100%;
    perspective: 1200px;
    overflow: hidden;
}

.mobius-main-inner {
    position: relative;
    height: 100%;
    transform-style: preserve-3d;
    perspective: 1200px;
}

.center-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    cursor: grab;
    z-index: 10;
}

.ninja-card {
    position: absolute;
    width: 160px;
    height: 220px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                opacity 0.8s ease, filter 0.5s ease;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transform-origin: center center;
    opacity: 0.65;
    filter: saturate(0.75) contrast(0.9);
}

.ninja-card:hover {
    opacity: 0.9;
    filter: saturate(1.1) contrast(1.05);
    box-shadow: 0 8px 20px rgba(255, 69, 0, 0.2);
}

.ninja-image {
    height: 65%;
    background-size: cover;
    background-position: center top;
    border-radius: 18px;
    border: 2px solid #ffe0b2;
    box-shadow: 0 4px 16px 0 rgba(255, 140, 0, 0.10), 0 1.5px 6px 0 rgba(0,0,0,0.07);
    background-color: transparent;
    overflow: hidden;
    transition: box-shadow 0.3s, border 0.3s;
}

.ninja-info {
    padding: 10px;
    text-align: center;
}

.ninja-name {
    font-size: 1.1em;
    margin-bottom: 5px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ninja-level {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
}

/* 等级颜色 - 增强渐变效果 */
.level-S {
    background: linear-gradient(135deg, #FF4500, #FF8C00);
    box-shadow: 0 3px 10px rgba(255, 69, 0, 0.3);
}

.level-A {
    background: linear-gradient(135deg, #9932CC, #8A2BE2);
    box-shadow: 0 3px 10px rgba(153, 50, 204, 0.3);
}

.level-B {
    background: linear-gradient(135deg, #1E90FF, #00BFFF);
    box-shadow: 0 3px 10px rgba(30, 144, 255, 0.3);
}

.level-C {
    background: linear-gradient(135deg, #2E8B57, #3CB371);
    box-shadow: 0 3px 10px rgba(46, 139, 87, 0.3);
}

.level-time {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.3);
}

/* 加载和错误状态 */
.loading {
    padding: 20px;
    text-align: center;
    font-size: 1.2em;
    color: #666;
}

.error {
    padding: 20px;
    text-align: center;
    font-size: 1.2em;
    color: #FF4500;
}

/* 等级标签样式 */
.level-tags {
    margin-top: 5px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.level-tag {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 添加卡片和图片精致的边框和阴影效果 */
.featured-card {
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.featured-image {
    position: relative;
}

/* 添加卡片悬停时的反光效果 */
.featured-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0) 40%,
        rgba(255, 255, 255, 0) 60%,
        rgba(255, 255, 255, 0.1) 100%
    );
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.featured-card:hover::after {
    opacity: 1;
}

/* 添加卡片翻转过渡动画 */
@keyframes flipIn {
    from {
        opacity: 0;
        transform: translateY(30px) rotateY(-10deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateY(0);
    }
}

.featured-card {
    animation: flipIn 0.8s ease-out forwards;
    animation-delay: calc(var(--card-index, 0) * 0.15s);
    opacity: 0;
}

/* 历史记录弹窗样式 */
.history-modal {
    display: none; /* 默认隐藏 */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background: rgba(0,0,0,0.35);
    justify-content: center;
    align-items: center;
}

.history-modal-content {
    background: #fff;
    margin: 10vh auto;
    padding: 30px 24px 18px 24px;
    border-radius: 16px;
    width: 90vw;
    max-width: 700px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    position: relative;
    text-align: left;
}

.close-history {
    position: absolute;
    right: 18px;
    top: 12px;
    font-size: 1.5em;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
}
.close-history:hover {
    color: #FF4500;
}

#historyList {
    max-height: 260px;
    overflow-y: auto;
    margin: 18px 0 16px 0;
    padding-left: 18px;
    font-size: 1em;
    color: #333;
}
#historyList li {
    margin-bottom: 8px;
    border-bottom: 1px dashed #eee;
    padding-bottom: 4px;
    word-break: break-all;
}

/* 显示弹窗时的样式 */
.history-modal[style*="display: block"] {
    display: flex !important;
} 

/* 历史记录分组美化 */
.history-group {
    background: #fff7ee;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.08);
    margin-bottom: 16px;
    padding: 10px 18px;
    display: flex;
    gap: 12px;
    align-items: center;
}
.history-group li {
    flex: 1;
    min-width: 0;
    list-style: none;
    font-size: 1.08em;
    color: #d2691e;
    padding: 2px 8px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fff3e0 70%, #ffe0b2 100%);
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.08), 0 1px 4px rgba(255, 140, 0, 0.04);
    text-align: center;
    margin: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ffe0b2;
    transition: box-shadow 0.2s, border 0.2s;
}
.history-group li:hover {
    box-shadow: 0 4px 16px rgba(255, 140, 0, 0.16);
    border: 1.5px solid #ffb74d;
    background: linear-gradient(135deg, #fffbe6 60%, #ffe0b2 100%);
}

#clearHistoryBtn {
    background: #FF4500;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
    position: absolute;
    right: 24px;
    bottom: 18px;
}
#clearHistoryBtn:hover {
    background: #d63b00;
}

/* 统一主按钮样式 */
.controls .main-btn,
.controls .random-btn,
.controls .history-btn {
  font-size: 1.08em;
  padding: 8px 18px;
  height: 40px;
  border-radius: 22px;
  background: #ff9800;
  color: #fff;
  border: none;
  margin: 0 6px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(255,140,0,0.08);
}
.controls .main-btn:hover,
.controls .random-btn:hover,
.controls .history-btn:hover,
.controls .main-btn:focus,
.controls .random-btn:focus,
.controls .history-btn:focus {
  background: #ff6600;
} 

/* 搜索弹窗样式 */
.search-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.35);
    justify-content: center;
    align-items: center;
}
.search-modal-content {
    background: #fff;
    margin: 10vh auto;
    padding: 32px 32px 24px 32px;
    border-radius: 18px;
    width: 90vw;
    max-width: 1000px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    position: relative;
    text-align: left;
    min-height: 220px;
}
.close-search {
    position: absolute;
    right: 24px;
    top: 18px;
    font-size: 1.5em;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
}
.close-search:hover {
    color: #FF4500;
}
#searchInput {
    width: 100%;
    padding: 12px 16px;
    font-size: 1.1em;
    border: 1.5px solid #eee;
    border-radius: 10px;
    margin: 18px 0 24px 0;
    outline: none;
    transition: border 0.2s;
    box-sizing: border-box;
}
#searchInput:focus {
    border: 1.5px solid #FF4500;
}
.search-results {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    min-height: 80px;
    max-height: 520px;
    overflow-y: auto;
}
.search-results .featured-card {
    margin: 0;
    flex: 0 0 calc(33.333% - 20px);
    max-width: calc(33.333% - 20px);
    min-width: 180px;
    box-sizing: border-box;
} 

.search-history-bar {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 16px;
}
.search-history {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 28px;
}
.search-history-tag {
    background: #fff3e0;
    color: #d2691e;
    border-radius: 12px;
    padding: 4px 14px;
    font-size: 1em;
    cursor: pointer;
    border: 1px solid #ffe0b2;
    transition: background 0.2s, color 0.2s, border 0.2s;
    margin-bottom: 2px;
    user-select: none;
}
.search-history-tag:hover {
    background: #ffe0b2;
    color: #ff6600;
    border: 1.5px solid #ffb74d;
}
.clear-search-history-btn {
    background: #FF4500;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 0.98em;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 8px;
    height: 32px;
    line-height: 20px;
}
.clear-search-history-btn:hover {
    background: #d63b00;
} 

.fix-btn, .unfix-btn {
    display: inline-block;
    background: linear-gradient(135deg, #FF9800, #FF4500);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 1em; /* 恢复原字体大小 */
    font-weight: bold;
    padding: 2px 10px; /* 恢复原padding */
    margin-top: 2px; /* 恢复原margin-top */
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(255, 69, 0, 0.18);
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}
.fix-btn:hover, .unfix-btn:hover {
    background: linear-gradient(135deg, #FF6600, #FF4500);
    color: #fffbe6;
    box-shadow: 0 6px 18px rgba(255, 69, 0, 0.28);
} 