/* ==================================================================
   장 마감 모달
   구 style.css 2299~3039줄
   ⚠️ 파일명 번호 = 로드 순서. 뒤 파일이 앞을 덮어쓰므로 순서를 바꾸면 화면이 깨진다.
   ================================================================== */
/* --- Market Close Modal Styles matches market-close.html --- */
#news-modal .market-close-wrapper {
    font-family: 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: white;
    padding: 30px;
    box-sizing: border-box;
}

#news-modal .market-briefing {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #0f3460;
    border-radius: 2px;
    padding: 25px 30px;
    margin: 0 auto 40px;
    max-width: 1200px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    text-align: center;
}

#news-modal .market-briefing-badge {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    font-weight: 900;
    padding: 10px 25px;
    border-radius: 2px;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    display: inline-block;
    margin-bottom: 20px;
}

#news-modal .market-briefing-content {
    font-size: 1.4rem;
    line-height: 1.8;
    color: #fff;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.3px;
    padding: 20px;
    border-radius: 2px;
    border-left: 4px solid #ffd700;
}

#news-modal .news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

#news-modal .news-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 2px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#news-modal .stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#news-modal .stock-name {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

#news-modal .stock-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

#news-modal .stock-price {
    font-size: 1.3rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#news-modal .delist-badge {
    background: #ff0000;
    color: white;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 0.9rem;
    margin-left: 10px;
    animation: blink 1s infinite;
}

#news-modal .news-content {
    font-size: 1rem;
    line-height: 1.6;
    color: #ddd;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    border-left: 3px solid rgba(255, 215, 0, 0.5);
}

#news-modal .percentage-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

#news-modal .percentage-display.rise {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.4);
}

#news-modal .percentage-display.fall {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 0 30px rgba(79, 172, 254, 0.4);
}

#news-modal .percentage-display.neutral {
    background: linear-gradient(135deg, #888, #666);
    box-shadow: 0 0 30px rgba(136, 136, 136, 0.4);
}

#news-modal .percentage-value {
    font-size: 3rem;
    font-weight: 900;
    color: white;
}

#news-modal .percentage-icon {
    font-size: 2rem;
    margin-right: 15px;
}

#news-modal .close-modal-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    z-index: 1000;
}

/* Blind Mode Blur Effect */
.blind-active table {
    filter: blur(10px);
    -webkit-filter: blur(10px);
    pointer-events: none;
}


@media screen and (max-width: 768px) {

    /* [통합 모바일 최적화 v6 FINAL - 뉴스 카드 2열] */
    .container {
        padding: 2px !important;
        padding-bottom: 120px !important;
    }

    .timer-area {
        padding: 2px 0 !important;
        gap: 1px !important;
    }

    .date-display {
        font-size: 1.1rem !important;
        margin-bottom: 2px !important;
    }

    .year-badge {
        font-size: 0.85rem !important;
        padding: 1px 4px !important;
    }

    .timer-bar-container {
        height: 4px !important;
    }

    /* 헤더 */
    .admin-header {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 0 5px !important;
        margin-bottom: 2px !important;
    }

    .admin-header h3 {
        font-size: 0.9rem !important;
        margin: 0 !important;
        flex: 1 !important;
    }

    .admin-header button {
        padding: 4px 6px !important;
        font-size: 0.75rem !important;
    }

    .close-btn {
        font-size: 20px !important;
    }

    /* 3. 설정 패널 (Grid Layout) */
    .scenario-panel {
        padding: 5px !important;
        gap: 5px !important;
    }

    .scenario-panel>div:nth-child(3) {
        display: grid !important;
        grid-template-columns: auto auto auto !important;
        gap: 8px !important;
        white-space: normal !important;
        overflow: visible !important;
        padding-bottom: 8px !important;
        border-bottom: 1px solid #444 !important;
        margin-bottom: 8px !important;
        justify-content: space-between !important;
    }

    .scenario-panel>div:nth-child(3)>div {
        display: flex !important;
        align-items: center !important;
        gap: 3px !important;
        width: auto !important;
    }

    .scenario-panel>div:nth-child(3)>div:nth-child(5) {
        grid-column: span 2 !important;
        justify-content: flex-end !important;
    }

    .scenario-panel input[type="number"] {
        height: 26px !important;
        min-height: 26px !important;
        font-size: 14px !important;
        width: 40px !important;
        padding: 0 2px !important;
    }

    .stock-control-btn {
        height: 26px !important;
        min-height: 26px !important;
        padding: 0 8px !important;
    }

    .radio-label {
        font-size: 0.8rem !important;
    }

    /* 4. 버튼 그룹 */
    .scenario-panel .button-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100% !important;
        grid-template-columns: none !important;
    }

    .scenario-panel .button-group>div {
        display: flex !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .scenario-panel .button-group>div>button.sub-btn {
        flex: 1 !important;
        width: 50% !important;
        margin: 0 !important;
    }

    .scenario-panel .button-group>button.main-btn {
        width: 100% !important;
        margin: 0 !important;
    }

    .scenario-panel .button-group .sub-btn,
    .scenario-panel .button-group .main-btn {
        padding: 0 !important;
        height: 38px !important;
        min-height: 38px !important;
        font-size: 0.9rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* 5. 테이블 최적화 */
    .table-wrapper {
        margin-top: 5px !important;
        max-height: 60vh !important;
    }

    table {
        width: 100% !important;
    }

    th {
        padding: 0 1px !important;
        font-size: 0.75rem !important;
        height: 22px !important;
    }

    td {
        padding: 0 !important;
        font-size: 0.75rem !important;
        height: 26px !important;
    }

    td input {
        height: 24px !important;
        min-height: 24px !important;
        font-size: 0.75rem !important;
        padding: 0 !important;
        text-align: center !important;
        border: 1px solid #555 !important;
    }

    .prob-input {
        width: 22px !important;
    }

    .num-input {
        width: 38px !important;
    }

    .name-input {
        width: 45px !important;
    }

    .keyword-input {
        width: 100% !important;
        font-size: 0.7rem !important;
    }

    /* 6. 뉴스 모달 (장 마감 브리핑) 최적화 */
    #news-modal .market-close-wrapper {
        padding: 10px !important;
    }

    #news-modal .market-briefing {
        padding: 10px !important;
        margin-bottom: 15px !important;
    }

    #news-modal .market-briefing-badge {
        font-size: 0.9rem !important;
        padding: 4px 12px !important;
        margin-bottom: 8px !important;
    }

    #news-modal .market-briefing-content {
        font-size: 0.85rem !important;
        padding: 8px !important;
        line-height: 1.4 !important;
    }

    /* 뉴스 그리드: 2열 배치 */
    #news-modal .news-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        /* 2열 */
        gap: 8px !important;
        margin-bottom: 20px !important;
    }

    #news-modal .news-card {
        padding: 10px !important;
        border-radius: 2px !important;
    }

    /* 뉴스 내용 축소 */
    #news-modal .stock-header {
        margin-bottom: 5px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 2px !important;
    }

    #news-modal .stock-name {
        font-size: 0.85rem !important;
        gap: 4px !important;
    }

    #news-modal .stock-icon {
        width: 20px !important;
        height: 20px !important;
        font-size: 0.7rem !important;
    }

    #news-modal .stock-price {
        font-size: 0.8rem !important;
    }

    #news-modal .delist-badge {
        font-size: 0.6rem !important;
        padding: 1px 4px !important;
        margin-left: 3px !important;
    }

    #news-modal .news-content {
        font-size: 0.7rem !important;
        padding: 6px !important;
        margin-bottom: 8px !important;
        line-height: 1.3 !important;
    }

    /* 등락률표시 최소화 */
    #news-modal .percentage-display {
        padding: 8px !important;
        border-radius: 2px !important;
        justify-content: flex-start !important;
    }

    #news-modal .percentage-value {
        font-size: 1.1rem !important;
    }

    #news-modal .percentage-icon {
        font-size: 0.9rem !important;
        margin-right: 4px !important;
    }

    /* 닫기 버튼 */
    #news-modal .close-modal-btn {
        bottom: 10px !important;
        right: 10px !important;
        padding: 8px 16px !important;
        font-size: 0.8rem !important;
    }


    /* 7. 기타 모달 및 메인화면 */
    #opening-modal .modal-content {
        width: 95% !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        padding: 10px !important;
        gap: 5px !important;
        justify-content: flex-start !important;
    }

    #opening-modal h2 {
        font-size: 0.95rem !important;
        margin: 5px 0 !important;
    }

    #slot-machine-display {
        font-size: 1.3rem !important;
        margin: 5px 0 !important;
        padding: 5px 10px !important;
    }

    #opening-modal button {
        margin: 5px auto 15px auto !important;
        padding: 8px !important;
        width: 70% !important;
    }

    .shop-sidebar {
        gap: 2px !important;
    }

    .shop-tab {
        padding: 6px 8px !important;
        font-size: 0.75rem !important;
        min-width: calc(16.6% - 5px) !important;
        flex: 0 0 auto !important;
    }

    .modal-content {
        padding: 5px !important;
    }

    .controls .button-group {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 4px !important;
    }

    .controls .button-group button {
        height: 36px !important;
        font-size: 0.85rem !important;
    }

    .chart-box {
        min-height: 35vh !important;
    }

    .status-board {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 3px !important;
    }

    .stock-card {
        height: 65px !important;
        min-height: 65px !important;
        max-height: 65px !important;
        padding: 3px 2px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        overflow: hidden !important;
    }

    .stock-number {
        width: 14px !important;
        height: 14px !important;
        font-size: 0.5rem !important;
        top: 2px !important;
        left: 2px !important;
    }

    .stock-name {
        font-size: 0.5rem !important;
        margin-top: 12px !important;
        margin-bottom: 2px !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
        line-height: 1.1 !important;
        width: 100% !important;
        text-align: center !important;
    }

    /* 글자 수별 폰트 크기 조정 (모바일) */
    .stock-name.len-1-3 {
        font-size: 1.0rem !important;
        /* 1-3글자: 크게 */
    }

    .stock-name.len-4 {
        font-size: 0.93rem !important;
        /* 4글자 */
    }

    .stock-name.len-5 {
        font-size: 0.8rem !important;
        /* 5글자 */
    }

    .stock-name.len-6 {
        font-size: 0.7rem !important;
        /* 6글자 */
    }

    .stock-name.len-7 {
        font-size: 0.68rem !important;
        /* 7글자 */
    }

    .stock-name.len-8-plus {
        font-size: 0.58rem !important;
        /* 8글자 이상 */
    }

    .stock-price {
        font-size: 0.55rem !important;
        line-height: 1.1 !important;
        margin: 1px 0 !important;
    }

    .stock-change {
        font-size: 0.5rem !important;
        margin-top: 0 !important;
        line-height: 1 !important;
    }

    .controls {
        flex-direction: column !important;
        padding: 5px !important;
        gap: 5px !important;
    }
}

/* [뉴스 모달 긴급 패치] */
@media screen and (max-width: 768px) {
    #news-modal .news-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        margin-bottom: 20px !important;
    }

    #news-modal .news-card {
        width: auto !important;
        min-width: 0 !important;
        padding: 8px !important;
        border-radius: 2px !important;
    }

    /* 내용 축소 */
    #news-modal .stock-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 2px !important;
        margin-bottom: 5px !important;
    }

    #news-modal .stock-name {
        font-size: 0.85rem !important;
        gap: 4px !important;
    }

    #news-modal .stock-icon {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.8rem !important;
    }

    #news-modal .news-content {
        font-size: 0.75rem !important;
        padding: 6px !important;
        line-height: 1.3 !important;
    }

    #news-modal .percentage-display {
        padding: 8px !important;
    }

    #news-modal .percentage-value {
        font-size: 1.2rem !important;
    }

    #news-modal .percentage-icon {
        font-size: 1rem !important;
    }

    #news-modal .close-modal-btn {
        bottom: 20px !important;
        right: 20px !important;
        padding: 10px 20px !important;
        font-size: 0.9rem !important;
    }
}

/* [관전 모드 로그인] */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

/* 방 생성/관리 박스 — 굵은 금색 2px 테두리가 모달 안에서 튀어 보여
   디자인 시스템의 은은한 경계선으로 교체 */
.login-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1));
    border-radius: 2px;
    padding: 16px;
    max-width: 400px;
}

/* 동적 생성되는 닫기 버튼 디자인 */
.close-btn-fixed {
    background: transparent !important;
    border: 2px solid #fff !important;
    color: #fff !important;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10001;
    /* 최상단 보장 */
    transition: all 0.3s ease;
}

.close-btn-fixed:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

/* \ubaa8\ubc14\uc77c \ucd94\uac00 \uc2a4\ud0c0\uc77c - \uc8fc\uc2dd \ubf51\uae30 \ubc84\ud2bc */
@media (max-width: 768px) {

    /* 모바일 추가 스타일 - 주식 뽑기 버튼 */
    /* 주식 뽑기 모달 크기 제어 */
    #opening-modal .modal-content {
        min-width: auto !important;
        width: 90% !important;
        max-width: 90% !important;
    }

    /* 주식 뽑기 STOP 버튼 */
    #opening-modal button,
    #slot-stop-btn {
        width: 70% !important;
        max-width: 250px !important;
        margin: 10px auto !important;
    }
}
