@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&family=Orbitron:wght@400;700&display=swap');

:root {
    --bg-primary: #1a0a2e;
    --bg-secondary: #2d1b4e;
    --bg-card: #3d2b5e;
    --accent-gold: #ffd700;
    --accent-purple: #8800ff;
    --text-primary: #ffffff;
    --text-secondary: #b8a8d0;
    --border-color: #4d3b6e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 背景粒子效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(136, 0, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 0, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    position: relative;
    z-index: 1;
}

/* 游戏标题 */
.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    padding: 24px 0;
    background: linear-gradient(135deg, var(--accent-gold), #fff5cc, var(--accent-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    letter-spacing: 4px;
}

/* 按钮区域 */
.button-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.btn {
    flex: 1;
    padding: 16px 24px;
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 18px;
    font-weight: 700;
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-start {
    background: linear-gradient(135deg, #2d5a1e, #4a8c32);
    color: white;
}

.btn-start:hover:not(:disabled) {
    background: linear-gradient(135deg, #3d7a2e, #5aac42);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(74, 140, 50, 0.5);
}

.btn-stop {
    background: linear-gradient(135deg, #5a1e1e, #8c3232);
    color: white;
}

.btn-stop:hover:not(:disabled) {
    background: linear-gradient(135deg, #7a2e2e, #ac4242);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(140, 50, 50, 0.5);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

/* 等级区域 */
.level-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.level-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.level-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.exp-display {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 8px;
}

.current-exp {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-gold);
}

.exp-separator {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0 4px;
}

.exp-to-next {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    color: var(--text-secondary);
}

.exp-bar-container {
    position: relative;
    height: 20px;
    background: var(--bg-primary);
    border-radius: 10px;
    overflow: hidden;
}

.exp-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-gold));
    border-radius: 10px;
    transition: width 0.3s ease;
}

.exp-percent {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* 日志区域 */
.log-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.log-header {
    background: var(--bg-card);
    padding: 12px 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.log-header::before {
    content: '📜';
}

.log-container {
    height: 150px;
    overflow-y: auto;
    padding: 8px;
}

.log-container::-webkit-scrollbar {
    width: 6px;
}

.log-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.log-container::-webkit-scrollbar-thumb {
    background: var(--accent-purple);
    border-radius: 3px;
}

.log-item {
    padding: 6px 8px;
    font-size: 13px;
    border-bottom: 1px solid rgba(77, 59, 110, 0.3);
    display: flex;
    gap: 8px;
    opacity: 0.7;
}

.log-item.new {
    opacity: 1;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.log-time {
    color: var(--text-secondary);
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    min-width: 65px;
}

.log-text {
    color: var(--text-primary);
}

/* 统计区域 */
.stats-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.stats-header {
    background: var(--bg-card);
    padding: 12px 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border-color);
}

.stat-item {
    background: var(--bg-primary);
    padding: 12px 8px;
    text-align: center;
}

.stat-value {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.stat-white .stat-value { color: #FFFFFF; }
.stat-green .stat-value { color: #00FF00; }
.stat-blue .stat-value { color: #0088FF; }
.stat-purple .stat-value { color: #8800FF; }
.stat-gold .stat-value { color: #FFD700; }
.stat-red .stat-value { color: #FF0000; }
.stat-rainbow .stat-value { 
    background: linear-gradient(90deg, #FF0000, #FF8800, #FFD700, #00FF00, #0088FF, #8800FF, #FF00FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 背包区域 */
.backpack-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.backpack-header {
    background: var(--bg-card);
    padding: 12px 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.backpack-header::before {
    content: '🎒';
    margin-right: 8px;
}

.backpack-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.backpack-count {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: var(--accent-gold);
}

.action-btn {
    padding: 4px 12px;
    font-size: 12px;
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid rgba(255, 0, 0, 0.5);
    border-radius: 4px;
    color: #FF6666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 0, 0, 0.3);
    transform: scale(1.05);
}

.backpack-container {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.backpack-container::-webkit-scrollbar {
    width: 6px;
}

.backpack-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.backpack-container::-webkit-scrollbar-thumb {
    background: var(--accent-purple);
    border-radius: 3px;
}

.empty-backpack {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-style: italic;
}

/* 装备卡片 */
.equipment-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.equipment-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--item-color);
}

/* 彩虹特殊样式 */
.equipment-rainbow {
    border: 2px solid transparent;
    background-image: linear-gradient(var(--bg-card), var(--bg-card)), 
                      linear-gradient(45deg, #ff6b9d, #fec89a, #f7edd4, #98d8c8, #7dd3fc, #c4b5fd, #f0abfc);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    animation: rainbowGlow 3s ease-in-out infinite;
}

.equipment-rainbow::before {
    background: linear-gradient(90deg, #ff6b9d, #fec89a, #f7edd4, #98d8c8, #7dd3fc, #c4b5fd, #f0abfc);
    animation: rainbowBar 3s linear infinite;
    background-size: 200% 100%;
}

@keyframes rainbowGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 107, 157, 0.4), 0 0 30px rgba(255, 107, 157, 0.2); }
    16% { box-shadow: 0 0 15px rgba(254, 200, 154, 0.4), 0 0 30px rgba(254, 200, 154, 0.2); }
    33% { box-shadow: 0 0 15px rgba(247, 237, 212, 0.4), 0 0 30px rgba(247, 237, 212, 0.2); }
    50% { box-shadow: 0 0 15px rgba(152, 216, 200, 0.4), 0 0 30px rgba(152, 216, 200, 0.2); }
    66% { box-shadow: 0 0 15px rgba(125, 211, 252, 0.4), 0 0 30px rgba(125, 211, 252, 0.2); }
    83% { box-shadow: 0 0 15px rgba(196, 181, 253, 0.4), 0 0 30px rgba(196, 181, 253, 0.2); }
}

@keyframes rainbowBar {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.rainbow-text {
    background: linear-gradient(90deg, #ff6b9d, #fec89a, #f7edd4, #98d8c8, #7dd3fc, #c4b5fd, #f0abfc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 100%;
    animation: rainbowText 3s linear infinite;
    text-shadow: none;
}

@keyframes rainbowText {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.equipment-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 10px color-mix(in srgb, var(--item-color) 30%, transparent);
}

.equipment-rainbow:hover {
    transform: translateY(-2px) scale(1.02);
}

.equipment-item:active {
    transform: scale(0.98);
}

.equipment-item.new {
    animation: equipmentPop 0.4s ease;
}

@keyframes equipmentPop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

.equipment-name {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
    text-shadow: 0 0 8px currentColor;
}

.equipment-type {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.equipment-rarity {
    font-size: 10px;
    font-weight: 500;
}

/* 装备详情弹窗 */
.equipment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.equipment-modal .modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 320px;
    width: 100%;
    overflow: hidden;
    animation: modalPop 0.3s ease;
}

@keyframes modalPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    background: var(--bg-card);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(77, 59, 110, 0.3);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.detail-value {
    font-weight: 500;
    font-size: 14px;
}

.modal-close-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-purple);
    border: none;
    border-radius: 0 0 12px 12px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s ease;
}

.modal-close-btn:hover {
    background: #aa00ff;
}

/* 底部操作区域 */
.footer-actions {
    margin-top: 20px;
    text-align: center;
}

.footer-btn {
    padding: 10px 32px;
    background: rgba(255, 100, 100, 0.2);
    border: 1px solid rgba(255, 100, 100, 0.5);
    border-radius: 8px;
    color: #FF6666;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.footer-btn:hover {
    background: rgba(255, 100, 100, 0.3);
    transform: scale(1.02);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .game-title {
        font-size: 22px;
        padding: 20px 0;
        letter-spacing: 2px;
    }

    .btn {
        padding: 14px 16px;
        font-size: 16px;
    }

    .backpack-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .equipment-name {
        font-size: 12px;
    }
}

/* 安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .container {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}
