/* ==========================================
   ⚡ 潮玩盲盒屋 全局样式设计表 (style.css)
   ========================================== */

/* 1. 核心设计系统与双主题配置 */
:root[data-theme="cyberpunk"] {
    --bg-color: #08080a;
    --panel-bg: rgba(15, 15, 20, 0.8);
    --card-bg: rgba(22, 22, 28, 0.9);
    --card-hover-bg: rgba(30, 30, 38, 0.95);
    
    --text-main: #f5f5f7;
    --text-sub: rgba(245, 245, 247, 0.6);
    --text-muted: rgba(245, 245, 247, 0.35);
    
    --accent-color: #00f2fe;
    --accent-glow: rgba(0, 242, 254, 0.4);
    --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    
    --border-color: rgba(255, 255, 255, 0.06);
    --border-active: rgba(0, 242, 254, 0.5);
    
    --font-display: 'Orbitron', 'Inter', -apple-system, "Noto Sans SC", sans-serif;
    --shadow-glow: 0 8px 32px rgba(0, 242, 254, 0.12);
}

:root[data-theme="sweet"] {
    --bg-color: #fff5f7;
    --panel-bg: rgba(255, 255, 255, 0.75);
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-hover-bg: rgba(255, 247, 249, 0.95);
    
    --text-main: #4a3e4d;
    --text-sub: rgba(74, 62, 77, 0.7);
    --text-muted: rgba(74, 62, 77, 0.45);
    
    --accent-color: #ff8fa3;
    --accent-glow: rgba(255, 143, 163, 0.4);
    --accent-gradient: linear-gradient(135deg, #ff8fa3 0%, #ffb3c1 100%);
    
    --border-color: rgba(255, 143, 163, 0.15);
    --border-active: rgba(255, 143, 163, 0.6);
    
    --font-display: 'Comfortaa', 'Inter', "Noto Sans SC", sans-serif;
    --shadow-glow: 0 8px 24px rgba(255, 143, 163, 0.15);
}

/* 2. 基础复位与根布局 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, "PingFang SC", "Noto Sans SC", sans-serif;
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.6;
}

/* 3. 头部导航区 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2.2rem;
    height: 2.2rem;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-sub);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    box-shadow: inset 0 -2px 0 var(--accent-color);
    border-radius: 8px 8px 0 0;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.coin-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 179, 0, 0.12);
    border: 1px solid rgba(255, 179, 0, 0.3);
    padding: 0.4rem 1rem;
    border-radius: 30px;
    font-family: var(--font-display);
    font-weight: 700;
    color: #ffb300;
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.08);
}

/* 4. 盲盒机大厅 */
.lobby-container {
    max-width: 1200px;
    margin: 2.5rem auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    flex: 1;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    position: relative;
    padding-left: 1rem;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    height: 70%;
    width: 4px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* 主题选择卡片 */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.theme-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
}

.theme-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-active);
    box-shadow: var(--shadow-glow);
}

.theme-banner {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.theme-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(to top, var(--card-bg), transparent);
}

.theme-badge {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-info {
    padding: 1.5rem;
}

.theme-name {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.theme-desc {
    color: var(--text-sub);
    font-size: 0.9rem;
    font-weight: 400;
    margin-bottom: 1.25rem;
}

.theme-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.theme-price {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    color: #ffb300;
}

.theme-stats {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* 5. 扭蛋机与抽奖详情区 */
.machine-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    margin-top: 1rem;
}

.machine-stage {
    flex: 1 1 450px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    padding: 3rem 2rem;
    min-height: 520px;
    position: relative;
    overflow: hidden;
}

/* 模拟扭蛋机主体 */
.capsule-machine {
    width: 280px;
    height: 380px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.machine-glass {
    width: 250px;
    height: 250px;
    background: rgba(255, 255, 255, 0.03);
    border: 4px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.05);
}

.capsules-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

/* 扭蛋球 */
.capsule-sphere {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: inset -4px -4px 10px rgba(0,0,0,0.3), 0 4px 8px rgba(0,0,0,0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.capsule-sphere::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 0, 0, 0.25);
}

/* 扭蛋机抖动状态 */
.machine-stage.shaking .capsule-sphere {
    animation: bounce-capsule 0.15s infinite alternate;
}

.machine-stage.shaking .machine-glass {
    animation: machine-shake 0.1s infinite;
}

.machine-base {
    width: 220px;
    height: 120px;
    background: linear-gradient(180deg, var(--accent-color) 0%, rgba(0,0,0,0.6) 100%);
    border-radius: 12px 12px 30px 30px;
    margin-top: -30px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15px;
    border: 1px solid var(--border-color);
}

.crank-handle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #2e2e36;
    border: 4px solid var(--text-muted);
    position: relative;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    transition: transform 0.8s ease;
}

.crank-handle::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 28px;
    background: #ffb300;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 5px;
}

.crank-handle.rotating {
    transform: rotate(360deg);
}

.exit-gate {
    width: 80px;
    height: 50px;
    background: #15151c;
    border-radius: 10px 10px 0 0;
    margin-top: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.exit-gate::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: var(--accent-glow);
    border-radius: 50%;
    filter: blur(10px);
}

/* 控制按钮 */
.action-row {
    display: flex;
    gap: 1.5rem;
    margin-top: 2.5rem;
    z-index: 20;
}

.action-btn {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0.9rem 2.2rem;
    cursor: pointer;
    box-shadow: 0 6px 20px var(--accent-glow);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-btn:hover:not(:disabled) {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.action-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    box-shadow: none;
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.detail-panel {
    flex: 1 1 400px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.detail-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* 爆率表格 */
.odds-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
}

.odds-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-sub);
}

.odds-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

/* 6. 稀有度标签系统 (R/SR/SSR/UR) */
.rarity-pill {
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    font-family: var(--font-display);
    color: #fff;
    display: inline-block;
}

.rarity-ur {
    background: linear-gradient(135deg, #ff007f 0%, #7928ca 100%);
    box-shadow: 0 0 8px rgba(255, 0, 127, 0.4);
}

.rarity-ssr {
    background: linear-gradient(135deg, #ffb300 0%, #ff4e00 100%);
    box-shadow: 0 0 8px rgba(255, 179, 0, 0.4);
}

.rarity-sr {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

.rarity-r {
    background: linear-gradient(135deg, #7e8c8d 0%, #95a5a6 100%);
}

.odds-pct {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-main);
}

/* 7. 图鉴收集室 (Trophy Room) 与背包 (Inventory) */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.5rem;
}

.item-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.25rem;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.item-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-active);
}

.item-card.locked {
    filter: grayscale(1);
    opacity: 0.45;
}

.item-img-container {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    background: rgba(255,255,255,0.02);
    border-radius: 12px;
    position: relative;
}

.item-img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    filter: drop-shadow(0 8px 12px rgba(0,0,0,0.15));
}

.item-card.locked .item-img {
    filter: drop-shadow(0 0 0 transparent) brightness(0.2);
}

.item-name {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-count-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-display);
}

.item-card.locked .item-count-badge {
    display: none;
}

/* 背包卡片回收动作 */
.recycle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.item-card:hover .recycle-overlay {
    opacity: 1;
    pointer-events: auto;
}

.recycle-btn {
    background: #ffb300;
    color: #000;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255,179,0,0.3);
}

/* 8. 全屏开箱翻牌弹窗 (RevealModal) */
.reveal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 4, 6, 0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    overflow-y: auto;
}

.reveal-cards-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    max-width: 1200px;
    margin: 2rem 0;
}

/* 3D 翻转卡片核心 */
.card-3d-wrapper {
    perspective: 1000px;
    width: 180px;
    height: 260px;
    cursor: pointer;
}

.card-3d {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-3d-wrapper.flipped .card-3d {
    transform: rotateY(180deg);
}

.card-side {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.08);
}

/* 卡片背面 (盲盒封面) */
.card-back {
    background: radial-gradient(circle at center, #1b1b22 0%, #0d0d11 100%);
}

.gacha-icon-glow {
    width: 60px;
    height: 60px;
    background: var(--accent-glow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulsate-glow 2s infinite ease-in-out;
}

.question-mark {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--accent-color);
}

/* 卡片正面 (开箱物品) */
.card-front {
    background: radial-gradient(circle at top, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.9) 100%);
    transform: rotateY(180deg);
    padding: 1.5rem;
    justify-content: space-between;
}

.card-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 22px;
    box-shadow: inset 0 0 20px rgba(255,255,255,0.05);
    pointer-events: none;
}

/* 根据稀有度动态上色 */
.card-front.ur-glow { border-color: rgba(255,0,127,0.7); box-shadow: 0 0 25px rgba(255,0,127,0.4); }
.card-front.ssr-glow { border-color: rgba(255,179,0,0.7); box-shadow: 0 0 25px rgba(255,179,0,0.4); }
.card-front.sr-glow { border-color: rgba(0,242,254,0.7); box-shadow: 0 0 25px rgba(0,242,254,0.4); }
.card-front.r-glow { border-color: rgba(180,180,180,0.4); }

.card-front .item-img-container {
    background: transparent;
    height: 110px;
    margin: 0;
}

/* 9. 右下角 Tweaks 调节控制台 */
.tweaks-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
}

.tweaks-trigger {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    box-shadow: 0 4px 15px var(--accent-glow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.3s ease;
}

.tweaks-trigger:hover {
    transform: rotate(45deg);
}

.tweaks-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 280px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.tweaks-title {
    font-size: 1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tweaks-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tweaks-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-sub);
}

.tweaks-select, .tweaks-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    padding: 0.5rem;
    outline: none;
    font-size: 0.85rem;
    cursor: pointer;
}

.tweaks-select:focus {
    border-color: var(--accent-color);
}

.tweaks-btn {
    font-weight: 700;
    text-align: center;
    transition: all 0.2s ease;
}

.tweaks-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--text-sub);
}

.tweaks-btn.active {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
}

/* 10. 各种 CSS Keyframe 动画 */

/* 扭蛋机抖动 */
@keyframes machine-shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(0px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(2px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(2px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* 扭蛋球物理晃动 */
@keyframes bounce-capsule {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(10deg); }
    100% { transform: translateY(5px) rotate(-10deg); }
}

/* 发光动画 */
@keyframes pulsate-glow {
    0% { box-shadow: 0 0 10px var(--accent-glow); }
    50% { box-shadow: 0 0 25px var(--accent-glow); }
    100% { box-shadow: 0 0 10px var(--accent-glow); }
}
