/* 音乐教培宠物领养激励系统 - 公共样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    touch-action: manipulation; /* 禁止双击缩放，防止游戏/按钮误放大 */
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; border: none; background: transparent; outline: none; }
button { border: none; outline: none; cursor: pointer; font-family: inherit; touch-action: manipulation; }
input, select, textarea { outline: none; font-family: inherit; }

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --accent: #FFB74D;
    --accent-dark: #FF9800;
    --success: #52C41A;
    --warning: #FAAD14;
    --danger: #F5222D;
    --text: #333;
    --text-secondary: #999;
    --bg: #f5f7fa;
    --card: #fff;
    --border: #eee;
    --radius: 12px;
}

/* 通用容器 */
.container { max-width: 750px; margin: 0 auto; padding: 12px; min-height: 100vh; padding-bottom: 70px; overflow-x: hidden; }

/* 卡片 */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s;
    border: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:active { background: var(--accent-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* 底部Tab导航 */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 750px;
    margin: 0 auto;
    background: #fff;
    display: flex;
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0 6px;
    color: #999;
    font-size: 12px;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
}
.tabbar-item .icon {
    font-size: 22px;
    margin-bottom: 2px;
    transition: transform 0.25s ease, filter 0.25s ease;
    display: inline-block;
    line-height: 1;
}
.tabbar-item:active { transform: scale(0.95); }
/* 未选中：灰色、正常大小、无指示条 */
.tabbar-item { color: #999; font-weight: 400; }
/* 当前选中：主色 + 加粗 + 稍大字号 + 渐变底色 */
.tabbar-item.active {
    color: #667eea;
    font-weight: 700;
    font-size: 13px;
    background: linear-gradient(to top, rgba(102,126,234,0.14), rgba(102,126,234,0));
}
/* 当前图标：放大1.2倍 + 上移5px + 主色光晕 */
.tabbar-item.active .icon {
    color: #667eea;
    transform: translateY(-5px) scale(1.2);
    filter: drop-shadow(0 0 6px rgba(102,126,234,0.55));
}
/* 当前tab顶部小三角指示条 */
.tabbar-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #667eea;
}

/* 进度条 */
.progress {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}
.progress-bar.primary { background: linear-gradient(90deg, #FF6B9D, #FF8E53); }
.progress-bar.accent { background: linear-gradient(90deg, #FFB74D, #FFD180); }
.progress-bar.success { background: linear-gradient(90deg, var(--success), #95DE64); }
.progress-bar.danger { background: linear-gradient(90deg, var(--danger), #FF7875); }

/* 标签 */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.tag-primary { background: #E6F4FF; color: var(--primary); }
.tag-accent { background: #FFF7E6; color: var(--accent-dark); }
.tag-success { background: #F6FFED; color: var(--success); }
.tag-danger { background: #FFF1F0; color: var(--danger); }
.tag-warning { background: #FFFBE6; color: var(--warning); }

/* 列表 */
.list-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 12px;
    flex-shrink: 0;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .info .name { font-weight: 500; font-size: 15px; }
.list-item .info .desc { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }

/* 空状态 */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.empty .icon { font-size: 60px; margin-bottom: 12px; opacity: 0.3; }

/* 弹窗 */
.modal-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal {
    background: #fff;
    border-radius: var(--radius);
    width: 100%;
    max-width: 340px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; text-align: center; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* Toast */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 999;
    max-width: 80%;
    text-align: center;
    animation: toastIn 0.2s;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -40%); } to { opacity: 1; transform: translate(-50%, -50%); } }

/* 顶部标题栏 */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 16px;
    border-radius: 0 0 var(--radius) var(--radius);
    margin-bottom: 12px;
}
.header h1 { font-size: 18px; font-weight: 600; }
.header .sub { font-size: 12px; opacity: 0.8; margin-top: 4px; }

/* 网格 */
.grid { display: flex; flex-wrap: wrap; gap: 10px; }
.grid-item { flex: 1 1 calc(50% - 5px); min-width: 0; }
.grid-3 .grid-item { flex: 1 1 calc(33.33% - 7px); }
.grid-4 .grid-item { flex: 1 1 calc(25% - 8px); }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--primary); }

/* 徽章数字 */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 500;
}

/* 宠物卡片 */
.pet-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
}
.pet-card .pet-emoji {
    font-size: 56px;
    margin-bottom: 8px;
    display: inline-block;
    animation: petFloat 3s ease-in-out infinite;
}
@keyframes petFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.pet-card .pet-name { font-weight: 600; font-size: 15px; }
.pet-card .pet-level { font-size: 12px; color: var(--primary); margin-top: 2px; }
.pet-card.hungry { border: 2px solid var(--warning); }
.pet-card.dying { border: 2px solid var(--danger); animation: dyingPulse 1.5s infinite; }
.pet-card.dead { opacity: 0.5; filter: grayscale(1); }
@keyframes dyingPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(245,34,45,0.3); } 50% { box-shadow: 0 0 0 8px rgba(245,34,45,0); } }

/* 宠物图片（去除黑线，圆角+阴影） */
.pet-img, .pet-image, #petEmoji img, .pet-emoji img {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* 升级动效 */
.level-up-effect {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 300;
    text-align: center;
    animation: levelUpAnim 2s forwards;
    pointer-events: none;
}
.level-up-effect .text {
    font-size: 32px;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 2px 10px rgba(255,183,77,0.5);
}
@keyframes levelUpAnim {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    40% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}

/* 大屏专用样式 */
.screen-container {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
    overflow: hidden;
    position: relative;
}
.screen-header {
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.screen-header h1 { font-size: 28px; background: linear-gradient(90deg, #FFB74D, #FFD180); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.screen-body { padding: 30px 40px; height: calc(100vh - 90px); overflow: hidden; }
.screen-pet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
    height: 100%;
    align-content: start;
}
.screen-pet-card {
    background: rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.3s;
}
.screen-pet-card:hover { transform: translateY(-4px); }
.screen-pet-card .emoji { font-size: 64px; margin-bottom: 10px; }
.screen-pet-card .name { font-size: 16px; font-weight: 600; }
.screen-pet-card .level { font-size: 13px; color: #FFB74D; margin-top: 4px; }
.screen-pet-card .power { font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 2px; }
.screen-ranking-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    margin-bottom: 12px;
}
.screen-ranking-item .rank {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 16px;
    margin-right: 16px;
}
.rank-1 { background: linear-gradient(135deg, #FFD700, #FFA500); color: #333; }
.rank-2 { background: linear-gradient(135deg, #C0C0C0, #A8A8A8); color: #333; }
.rank-3 { background: linear-gradient(135deg, #CD7F32, #B87333); color: #fff; }
.rank-other { background: rgba(255,255,255,0.1); color: #fff; }

/* 事件弹窗 */
.event-popup {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.95);
    color: #333;
    padding: 30px 50px;
    border-radius: 20px;
    font-size: 24px;
    font-weight: 600;
    z-index: 500;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: eventPop 3s forwards;
}
@keyframes eventPop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    25% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}
