/* ./style_shop.css */
/* 职责：定义商店和老虎机的样式。*/

.shop-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 1rem;
}

/* 商店子标签样式 */
.shop-sub-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--color-border);
    flex-shrink: 0;
}
.shop-sub-tab {
    padding: 0.5rem 1.25rem;
    font-size: 1rem;
    font-weight: bold;
    background-color: transparent;
    color: var(--color-text-dim);
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    transform: translateY(2px);
}
.shop-sub-tab:hover {
    color: white;
}
.shop-sub-tab.active {
    color: var(--color-purple);
    border-bottom-color: var(--color-purple);
}
.shop-sub-panel {
    display: none;
    height: 100%;
    overflow-y: auto;
}
.shop-sub-panel.active {
    display: block;
}

/* 商店分组标题 */
.shop-section-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--color-purple);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}
/* 商店空消息 */
.shop-empty-message {
    text-align: center;
    color: var(--color-text-dim);
    font-style: italic;
    padding: 2rem;
}


.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    align-content: flex-start;
    padding: 0.5rem;
    background-color: var(--color-bg);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem; /* 组间距 */
}

.shop-item-card {
    background-color: var(--color-panel);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-left-width: 4px;
    border-left-color: var(--color-border);
    transition: border-color 0.3s ease;
}

/* --- 稀有度样式 --- */
.shop-item-card.rarity-common {
    border-left-color: #9ca3af; /* gray-400 */
}
.shop-item-card.rarity-mid {
    border-left-color: #3b82f6; /* blue-500 */
}
.shop-item-card.rarity-rare {
    border-left-color: #a855f7; /* purple-500 */
}
.shop-item-card.rarity-legendary,
.shop-item-card.rarity-ultra_rare {
    border-left-color: #f59e0b; /* amber-500 */
    animation: glowing-gold-border 1.5s infinite ease-in-out;
}
@keyframes glowing-gold-border {
    0% { box-shadow: 0 0 4px #f59e0b; }
    50% { box-shadow: 0 0 12px #f59e0b; }
    100% { box-shadow: 0 0 4px #f59e0b; }
}
/* --- 稀有度样式结束 --- */


.shop-item-card.disabled {
    opacity: 0.5;
    background-color: #111827;
}

.shop-item-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.shop-item-icon {
    width: 64px;
    height: 64px;
    background-color: var(--color-bg);
    border-radius: 0.25rem;
    flex-shrink: 0;
    padding: 0.25rem;
}

.shop-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.shop-item-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
}

.shop-item-desc {
    font-size: 0.85rem;
    color: var(--color-text-dim);
    margin-top: auto; 
    padding-top: 0.5rem;
    flex-grow: 1;
}

.shop-item-stack-count {
    font-size: 0.85rem;
    color: var(--color-text-dim);
    margin-top: 0.25rem;
}

.shop-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.shop-item-price {
    font-size: 1.1rem;
    font-weight: bold;
    color: #FBBF24;
}

.shop-buy-button {
    background-color: var(--color-purple);
    color: white;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.shop-buy-button:hover:not(:disabled) {
    background-color: #A78BFA;
}

.shop-buy-button:disabled {
    background-color: var(--color-panel-light);
    cursor: not-allowed;
    color: var(--color-text-dim);
}

/* --- “精选” (老虎机) 界面 --- */

/* 【新增】说明文字样式 */
.shop-instructions {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--color-text-dim);
    background-color: var(--color-bg);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}
.shop-instructions b {
    color: var(--color-purple);
    font-weight: bold;
}

.lottery-container {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: start;
    column-gap: 1.25rem;
    row-gap: 0;
    padding: 0.35rem;
    margin-bottom: 1rem; /* 与下方的精选池分开 */
}

/* 1. 刷新方块（左侧）：与「今日精选」卡片同高（JS 写入边长） */
.lottery-machine-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: max-content;
    max-width: none;
    margin: 0;
    position: relative;
    z-index: 1;
}

.lottery-machine-window {
    container-type: size;
    position: relative;
    flex: none;
    width: 15rem;
    height: 15rem;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    aspect-ratio: 1 / 1;
    margin: 0;
    border: 4px solid #4a5568;
    border-radius: 0.5rem;
    background-color: var(--color-bg);
    overflow: hidden;
    box-shadow: 0 0 15px rgba(0,0,0,0.5) inset;
    align-self: flex-start;
}

/* 2. 滚筒本身 (长条) */
.lottery-reel {
    display: flex;
    flex-direction: column;
}

/* 3. 滚筒中的项目（高度随取景框，container query） */
.lottery-reel-item {
    width: 100%;
    height: 100cqh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.55rem;
    box-sizing: border-box;
}

.lottery-reel-item img {
    max-width: 86%;
    max-height: 86%;
    object-fit: contain;
}

/* 4. 上下遮罩 (模拟真实感) */
.lottery-reel-shadow-top, .lottery-reel-shadow-bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, var(--color-bg), transparent);
    z-index: 2;
    pointer-events: none;
}
.lottery-reel-shadow-top {
    top: 0;
}
.lottery-reel-shadow-bottom {
    bottom: 0;
    background: linear-gradient(to top, var(--color-bg), transparent);
}

/* 5. 刷新：标价隐藏；整块窗口可点 */
.lottery-refresh-cost {
    display: none;
}

.lottery-refresh-button {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    z-index: 4;
}
.lottery-refresh-button:hover {
    background-color: rgba(139, 92, 246, 0.1);
}

.lottery-click-refresh-label,
.lottery-featured-item > .shop-section-title {
    flex-shrink: 0;
    margin: 0;
    padding: 0 0 0.5rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    letter-spacing: normal;
    line-height: 1.3;
    min-height: 1.6em;
    box-sizing: content-box;
}
.lottery-click-refresh-label {
    order: -1; /* 提到方块上方，与「今日精选」同行 */
    align-self: stretch;
    width: 100%;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--color-purple);
}

/* 刷新动画 (用于窗口) */
@keyframes slot-refresh-glow {
    0% { box-shadow: 0 0 15px rgba(0,0,0,0.5) inset; }
    50% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.8) inset; }
    100% { box-shadow: 0 0 15px rgba(0,0,0,0.5) inset; }
}
.lottery-machine-window.is-refreshing {
    animation: slot-refresh-glow 0.5s ease-in-out;
}

/* 6. 今日精选卡片（右侧） */
.lottery-featured-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 90%;
    max-width: none;
    justify-self: stretch;
    margin: 0;
    position: relative;
    z-index: 0;
}
.lottery-featured-item .shop-item-card {
    border-width: 2px;
    border-color: var(--color-purple);
    box-shadow: 0 0 15px var(--color-purple);
    padding: 1em;
    gap: 0.65rem;
    min-height: 0;
}
.lottery-featured-item .shop-item-header {
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}
.lottery-featured-item .shop-item-icon {
    width: 7.25rem;
    height: 7.25rem;
    flex-shrink: 0;
}
.lottery-featured-item .shop-item-name {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.3;
}
.lottery-featured-item .shop-item-stats {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.lottery-featured-item .lottery-total-cost-hint {
    flex-shrink: 0;
    margin-top: 0.5rem;
}

/* 7. 【新增】精选池网格样式 */
.lottery-pool-display {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: var(--color-bg);
    border-radius: 0.5rem;
    min-height: 120px; /* 至少有两行高 */
    align-content: flex-start;
}
.lottery-pool-item {
    aspect-ratio: 1/1;
    background-color: var(--color-panel);
    border: 1px solid var(--color-border);
    border-radius: 0.25rem;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lottery-pool-item img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

/* 8. 倒计时 */
.lottery-timer {
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text-dim);
    font-style: italic;
    margin-top: 1rem;
}

/* 9. 四季挑战选单 */
.seasons-challenge-options {
    text-align: left;
}
.seasons-challenge-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    background: rgba(0, 0, 0, 0.25);
    cursor: pointer;
}
.seasons-challenge-option.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.seasons-challenge-option-label {
    flex: 1;
    font-weight: 600;
}
.seasons-challenge-option-cost {
    font-size: 0.85rem;
    color: #c4b5fd;
}