/* 행운복권 - 스피또 형태 (행운번호 1개 + 숫자 6개, 당첨금 표시) */

.luckylottery-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 40px 16px 80px;
    padding-bottom: calc(50px + 20px);
    font-family: 'Pretendard', sans-serif;
    min-height: 100vh;
}

.luckylottery-header {
    text-align: center;
    margin-bottom: 24px;
}

.luckylottery-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
}

.luckylottery-subtitle {
    font-size: 0.88rem;
    color: #666;
    margin: 0;
}

.scratch-section {
    margin-bottom: 28px;
}

.scratch-card {
    background: linear-gradient(145deg, #fff8e8 0%, #fff 50%, #f5f0e8 100%);
    border-radius: 20px;
    padding: 20px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 3px solid #e8dcc8;
}

/* 2라인 레이아웃: 왼쪽 행운번호, 오른쪽 숫자 3+3 */
.scratch-layout {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
}

.scratch-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.lucky-label {
    font-size: 1rem;
    font-weight: 700;
    color: #5c4200;
}

.scratch-lucky {
    width: 120px;
    height: 150px;
}

.scratch-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-width: 0;
    max-width: 320px;
}

.scratch-lucky .scratch-result {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    font-weight: 700;
    color: #333;
    background: linear-gradient(160deg, #fff9e6 0%, #f5ecd6 100%);
    z-index: 0;
}

/* 숫자 영역: 상단 3개 / 하단 3개 */
.numbers-row {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
}

.numbers-row--top {
    margin-bottom: 0;
}

.numbers-row--bottom {
    margin-bottom: 0;
}

.scratch-cell-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.scratch-cell {
    position: relative;
    width: 82px;
    height: 98px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(160deg, #f0e6d8 0%, #e8dcc8 100%);
    border: 2px solid #d4c4a8;
}

.scratch-cell .scratch-result {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-weight: 700;
    color: #333;
    background: linear-gradient(160deg, #fff9e6 0%, #f5ecd6 100%);
    z-index: 0;
}

.scratch-cell .cell-num {
    font-size: 1.85rem;
    line-height: 1.2;
}

.scratch-cell .cell-prize {
    font-size: 0.78rem;
    color: #5c4200;
    line-height: 1.2;
}

.scratch-cell .scratch-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: pointer;
    touch-action: none;
    display: block;
}


.scratch-hint {
    font-size: 0.8rem;
    color: #888;
    text-align: center;
    margin: 0;
}

/* 당첨 결과 나온 후에만 복권 카드 하단에 노출 */
.luckylottery-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
    width: 100%;
}

.luckylottery-buttons.luckylottery-buttons--hidden {
    display: none !important;
}

.luckylottery-new-btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #d4a84a 0%, #c4942e 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(196, 148, 46, 0.35);
}

.luckylottery-new-btn:hover {
    background: linear-gradient(135deg, #c4942e 0%, #b08020 100%);
}

.hidden {
    display: none !important;
}

/* 결과 안내 레이어 */
.result-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    padding: 0 20px;
    max-width: 92%;
}

.result-toast-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 32px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
    animation: toast-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    word-break: keep-all;
    line-height: 1.4;
    min-width: 200px;
    max-width: 320px;
}

@keyframes toast-appear {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.result-toast-inner .toast-title {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
}

.result-toast-inner .toast-amount {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
}

.result-toast-inner .toast-desc {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.95;
}

/* 당첨: 정말 축하하는 느낌 */
.result-toast-inner.prize-win {
    background: linear-gradient(145deg, #ffd54f 0%, #ffb300 50%, #ff8f00 100%);
    color: #3e2723;
    border: 3px solid rgba(255, 255, 255, 0.6);
}

.result-toast-inner.prize-win .toast-title {
    color: #2d1f1b;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
}

.result-toast-inner.prize-win .toast-amount {
    color: #1b0f0a;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.5);
    letter-spacing: 0.02em;
}

.result-toast-inner.prize-win .toast-desc {
    color: #4e342e;
}

/* 낙첨: 정말 아쉬운 느낌 */
.result-toast-inner.prize-fail {
    background: linear-gradient(145deg, #eceff1 0%, #cfd8dc 50%, #b0bec5 100%);
    color: #455a64;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.result-toast-inner.prize-fail .toast-title {
    color: #37474f;
    font-weight: 700;
}

.result-toast-inner.prize-fail .toast-desc {
    color: #546e7a;
    font-weight: 500;
}

/* 당첨 내역 */
.history-section {
    background: #fff;
    border-radius: 16px;
    padding: 20px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.history-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.history-clear-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
}

.history-clear-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.history-total {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a7f37;
    margin: 0 0 12px 0;
}

.history-total.hidden {
    display: none !important;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-empty {
    font-size: 0.9rem;
    color: #999;
    text-align: center;
    margin: 0;
    padding: 16px 0;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.history-item.history-win {
    background: #f0faf0;
    border-left: 4px solid #2ecc71;
}

.history-item.history-fail {
    background: #f8f8f8;
    border-left: 4px solid #bbb;
}

.history-nums {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    min-width: 100px;
}

.history-label {
    font-weight: 600;
    color: #333;
}

.history-time {
    margin-left: auto;
    font-size: 0.8rem;
    color: #888;
}

@media (max-width: 420px) {
    .scratch-layout { gap: 12px; }
    .scratch-right { max-width: none; }
    .scratch-cell {
        width: 60px;
        height: 74px;
    }
    .scratch-cell .cell-num { font-size: 1.45rem; }
    .scratch-cell .cell-prize { font-size: 0.65rem; }
    #canvas0, #canvas1, #canvas2, #canvas3, #canvas4, #canvas5 {
        width: 60px !important;
        height: 74px !important;
    }
    .numbers-row { gap: 8px; }
    .scratch-lucky { width: 96px; height: 118px; }
    #canvasLucky { width: 96px !important; height: 118px !important; }
    .scratch-lucky .scratch-result { font-size: 2.2rem; }
}
