/* ---------- 根容器 ---------- */
.shiba-lottery-root {
    max-width: 1000px;
    margin: 20px auto;
    font-family: 'Noto Sans', sans-serif;
    color: #333;
    padding: 0 10px;
}

/* ---------- 標題 ---------- */
.shiba-lottery-root .shiba-lottery-title {
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 5px;
}
.shiba-lottery-root .shiba-lottery-subtitle {
    font-size: 16px;
    text-align: center;
    margin-bottom: 15px;
    color: #2980b9;
}

/* ---------- 上方資訊 ---------- */
.shiba-top {
    margin-bottom: 10px;
    font-size: 18px;
    text-align: center;
}
.shiba-top span {
    font-weight: bold;
    color: #d35400; /* 橘色高亮柴犬幣 */
}

/* ---------- 格子網格 ---------- */
.shiba-grid {
    display: grid;
    grid-template-columns: repeat(7, 40px); /* 一行固定10格 */
    grid-gap: 4px;
    justify-content: center;
    margin-bottom: 15px;
}

/* ---------- 格子 ---------- */
.shiba-cell {
    width: 100%;
    aspect-ratio: 1/1; /* 保持正方形 */
    background: #f9f9f9;
    border: 1px solid #ddd;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* 必須保留 */
    overflow: hidden;   /* 避免內部動畫跑出格子 */
    transition: background 0.2s, color 0.2s;
    overflow: hidden; /* ✅ 新增 */
}
.shiba-cell:hover:not(.taken):not(:disabled) {
    background: #ffe6d1;
}

/* 被抽過的格子 */
.shiba-cell.taken {
    background: #ddd;
    cursor: default;
    color: #999;
}
/* ✔ 絕對置中並自動縮放 */
.cell-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    font-size: 1.8rem; /* 可改成相對格子大小 */
    line-height: 1;
    pointer-events: none;
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1; /* 圖示在文字下面 */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
@media (max-width: 768px){
    .shiba-cell { font-size: 14px; } /* 12px 太小，改 14px */
}


/* ---------- 终结奖信息框 ---------- */
.lottery-info-box {
    border: 2px solid #f39c12;
    background: #fff8e1;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    color: #c0392b;
    animation: fadeIn 0.5s ease;
    /* 核心修改：改为相对定位，跟随文档流 */
    position: relative;
    margin: 10px auto; /* 上下间距10px，水平居中 */
    max-width: 90%; /* 限制宽度避免溢出 */
    z-index: 10; /* 确保在网格上方但不遮挡其他元素 */
}

/* 移动端适配微调 */
@media (max-width: 768px) {
    .lottery-info-box {
        font-size: 14px; /* 缩小字体 */
        padding: 10px; /* 减少内边距 */
        margin: 8px auto; /* 缩小间距 */
    }
}

@keyframes fadeIn {
    from {opacity:0; transform: scale(0.95);}
    to {opacity:1; transform: scale(1);}
}





/* ---------- 獎品圖示（修正版） ---------- */
.shiba-cell .prize-icon {
    position: absolute;  /* 絕對定位格子內 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;   /* 讓圖片填滿格子，保持比例 */
    pointer-events: none;
    z-index: 1;          /* 圖片在文字下面 */
}




/* ---------- 獎品彈出動畫 ---------- */
@keyframes pop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ---------- 抽獎訊息 ---------- */
.shiba-msg {
    font-size: 16px;
    margin-bottom: 10px;
    min-height: 24px;
    color: #c0392b;
    text-align: center;
}

/* ---------- 歷史紀錄 ---------- */
.shiba-history {
    font-size: 14px;
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.shiba-history-item {
    padding: 3px 0;
    border-bottom: 1px dashed #ccc;
}
.shiba-history-item:last-child { border-bottom: none; }

/* ---------- 狀態 ---------- */
#shiba-lottery-status {
    font-weight: bold;
    color: #2980b9;
    text-align: center;
    margin-bottom: 10px;
}

/* ---------- 行動裝置微調 ---------- */
@media (max-width: 768px){
    .shiba-grid { grid-template-columns: repeat(7, 40px); grid-gap: 4px; }
    .shiba-cell { font-size: 12px; }
    .shiba-cell .prize-icon {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保持比例填滿格子 */
}
    .shiba-top { font-size: 16px; }
    .shiba-lottery-title { font-size: 22px; }
    .shiba-lottery-subtitle { font-size: 14px; }
}
