/* ==================================================================
   상점 사이드바 · 차트 · 개봉 박스 · 룰 목록 · 로딩
   구 style.css 994~1460줄
   ⚠️ 파일명 번호 = 로드 순서. 뒤 파일이 앞을 덮어쓰므로 순서를 바꾸면 화면이 깨진다.
   ================================================================== */
.shop-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    overflow: hidden;
}

.shop-sidebar {
    display: flex;
    overflow-x: auto;
    gap: 5px;
    padding-bottom: 5px;
    background: #333;
    padding: 5px;
    border-radius: 5px;
    flex-shrink: 0;
}

.shop-tab {
    padding: 10px 15px;
    background: #444;
    border: none;
    color: #ccc;
    cursor: pointer;
    border-radius: 5px;
    white-space: nowrap;
    font-size: 0.9rem;
}

.shop-tab:hover,
.shop-tab.active {
    background: #ffd700;
    color: #000;
    font-weight: bold;
}

.shop-content {
    flex-grow: 1;
    background: #2a2a2a;
    border-radius: 2px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.info-card {
    border: 1px solid #555;
    border-radius: 2px;
    padding: 12px;
    background: #1e1e1e;
    display: flex;
    flex-direction: column;
    margin-bottom: 5px;
}

.info-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-tag {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
    color: #fff;
    font-weight: bold;
}

.price-low {
    background: #17a2b8;
}

.price-mid {
    background: #28a745;
}

.price-high {
    background: #ffc107;
    color: #000;
}

.price-max {
    background: #dc3545;
}

.chart-box {
    background: #1a1a1a;
    padding: 10px;
    border-radius: 2px;
    border: 1px solid #333;
    flex-grow: 1 !important;
    /* 남은 공간 모두 차지 */
    min-height: 200px;
    /* 최소 높이만 설정 */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* 넘치지 않도록 */
}

.chart-box canvas {
    max-height: 100%;
    max-width: 100%;
}

.reveal-box {
    flex-grow: 1;
    background: #000;
    color: #ccc;
    border-radius: 5px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-align: center;
    border: 1px solid #333;
    transition: 0.2s;
    min-height: 50px;
}

.reveal-text {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.click-guide {
    position: absolute;
    color: #ffd700;
    font-size: 1rem;
    font-weight: bold;
    pointer-events: none;
}

.reveal-box.revealed {
    background: #fff;
    color: #333;
    cursor: default;
    text-align: left;
    align-items: start;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Opening Modal Styles */
#opening-modal .modal-content {
    max-width: 500px;
    height: auto;
    min-height: 400px;
}

/* 브로드캠스트 모달 여백 축소 */
#broadcast-modal .modal-content {
    padding: 20px !important;
    /* 15px에서 20px로 약간 조정 */
    max-width: 380px !important;
}

#broadcast-modal h2 {
    margin-bottom: 5px !important;
}

#broadcast-modal p {
    margin-bottom: 5px !important;
}

#broadcast-modal .login-box {
    margin-bottom: 8px !important;
}

/* 주식뽑기 STOP 버튼 크기 축소 */
#slot-stop-btn {
    width: 80% !important;
    /* 가로폭 줄임 */
    max-width: 300px !important;
    font-size: 1rem !important;
    /* 폰트 축소 */
    padding: 10px 20px !important;
    /* 세로폭 대폭 촡소 */
    margin: 0 auto !important;
}

/* 주식뽑기 모달 모바일 최적화 추가 */

#opening-modal button {
    touch-action: manipulation;
    cursor: pointer;
}

@media (max-width: 768px) {

    /* 주식뽑기 모달 모바일 크기 조정 - 대폭 개선 */
    #opening-modal .modal-content {
        width: 85% !important;
        /* 90% -> 85% */
        min-width: auto !important;
        max-width: 85% !important;
        padding: 12px !important;
        /* 15px -> 12px */
        box-sizing: border-box !important;
        margin: 10px !important;
    }

    #slot-machine-display {
        font-size: 1.5rem !important;
        /* 1.8rem -> 1.5rem */
        margin: 10px 0 !important;
        /* 15px -> 10px */
        min-height: 50px !important;
    }

    #opening-modal h2 {
        font-size: 0.95rem !important;
        /* 1.1rem -> 0.95rem */
        white-space: normal !important;
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
        padding: 0 5px !important;
    }

    #opening-modal p {
        font-size: 0.8rem !important;
        /* 0.85rem -> 0.8rem */
        margin-bottom: 10px !important;
    }

    #opening-status {
        font-size: 0.8rem !important;
        /* 0.85rem -> 0.8rem */
        margin-bottom: 10px !important;
    }

    #slot-stop-btn {
        font-size: 0.85rem !important;
        /* 0.95rem -> 0.85rem */
        padding: 10px 8px !important;
        /* 12px 10px -> 10px 8px */
        width: 100% !important;
        margin-top: 5px !important;
    }

    /* 브로드캠스트 모달 모바일 최적화 */
    #broadcast-modal .modal-content {
        max-width: 85% !important;
        width: 85% !important;
        padding: 15px !important;
        box-sizing: border-box !important;
    }

    #broadcast-modal h2 {
        font-size: 1.1rem !important;
        margin-bottom: 10px !important;
    }

    #broadcast-modal p {
        font-size: 0.8rem !important;
        margin-bottom: 10px !important;
        line-height: 1.3 !important;
    }

    #broadcast-modal #broadcast-link {
        font-size: 1rem !important;
        letter-spacing: 1px !important;
        padding: 8px !important;
    }

    #broadcast-modal .main-btn,
    #broadcast-modal .sub-btn {
        font-size: 0.85rem !important;
        padding: 10px !important;
    }

    /* 관전모드 로그인 화면 모바일 최적화 */
    #login-screen h1 {
        font-size: 1.5rem !important;
    }

    #login-screen .login-box {
        width: 85% !important;
        padding: 20px !important;
    }

    #login-screen #room-id-input {
        font-size: 1.1rem !important;
        padding: 12px !important;
    }

    #login-screen #join-btn {
        font-size: 1rem !important;
        padding: 12px !important;
    }
}

/* Info Shop Responsive */
@media (max-width: 768px) {
    .shop-sidebar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .shop-tab {
        min-width: 100px;
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .info-card {
        padding: 10px;
    }

    .info-title {
        font-size: 0.9rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* News Modal Responsive */
@media (max-width: 768px) {
    .news-modal-content {
        width: 98%;
        padding: 10px;
    }

    .news-modal-header h2 {
        font-size: 1.3rem;
    }

    .news-modal-subtitle {
        font-size: 0.85rem;
    }

    .news-card {
        padding: 12px;
    }

    .news-header {
        font-size: 0.9rem;
    }

    .news-body {
        font-size: 0.85rem;
    }
}

/* Improve touch targets */
@media (hover: none) {

    button,
    .sub-btn,
    .main-btn,
    .shop-tab {
        min-height: 44px;
    }

    input[type="number"] {
        min-height: 40px;
        font-size: 16px !important;
    }
}

.reveal-box.revealed .click-guide {
    display: none;
}

.reveal-box.revealed .reveal-text {
    visibility: visible;
    opacity: 1;
}

.rule-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    flex-grow: 1;
}

.rule-item {
    background: #333;
    border-radius: 2px;
    padding: 15px;
    border-left: 5px solid #555;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.rule-item.highlight {
    border-left-color: #ffd700;
    background: #2a2a2a;
}

.rule-item.danger {
    border-left-color: #ff4d4d;
}

.rule-title {
    display: block;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rule-desc {
    font-size: 0.9rem;
    color: #ccc;
    line-height: 1.5;
    margin: 0;
}

#loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 4000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #ffd700;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
