@charset "UTF-8";

/* --- 공통 스타일 --- */
html {
    /* 모바일 pull-to-refresh 방지 */
    overscroll-behavior-y: contain;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--ns-bg-primary, #0b0b15);
    color: var(--ns-text-primary, #e0e6ed);
    margin: 0;
    padding: 0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    overflow: hidden;
    height: 100vh;
    height: 100svh;
    max-height: 100svh;
    display: flex;
    flex-direction: column;
    /* 모바일 pull-to-refresh 방지 */
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.2);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.35);
}

#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('img/background.webp') no-repeat center center fixed;
    background-size: cover;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    /* 빛 효과가 화면 밖으로 나갈 때 스크롤 생기지 않도록 */
}

/* 빛나는 라인 효과 (스캔라인) */
#start-screen::after {
    content: "";
    position: absolute;
    top: -50%;
    left: 0;
    width: 100%;
    height: 100px;
    /* 빛의 두께 */
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: rotate(0deg);
    /* 일자로 내려오도록 */
    animation: shine-scan 4s infinite linear;
    pointer-events: none;
    /* 클릭 방해하지 않음 */
    z-index: 1;
    /* 로고/버튼 뒤? 앞? 앞이면 버튼 색이 변함. 보통 맨 위나 로고 위. */
}

/* z-index 조정: 로고와 버튼이 빛 효과보다 위에 오게 할지, 아래에 오게 할지 결정.
   "광나는 듯한 효과"라면 위에 덮어씌워야 함. 하지만 버튼 클릭은 되어야 하므로 pointer-events: none 필수.
*/

@keyframes shine-scan {
    0% {
        top: -20%;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 120%;
        opacity: 0;
    }
}

.start-btn-group {
    display: flex;
    flex-direction: row;
    /* 모바일에서도 가로 배치 */
    gap: 8px;
    /* 간격 축소 */
    width: 100%;
    align-items: stretch;
    /* 높이 맞춤 */
    justify-content: center;
    padding: 0 10px;
    /* 양옆 여백 */
    box-sizing: border-box;
}

/* 모바일 전용 버튼 스타일 재정의 */
@media (max-width: 768px) {
    .mode-btn {
        width: auto !important;
        flex: 1;
        /* 가로 공간 균등 분할 */
        padding: 10px 5px !important;
        /* 패딩 대폭 축소 */
        font-size: 0.85rem !important;
        /* 폰트 크기 축소 */
        min-height: 80px;
        /* 최소 높이 확보 */
        max-width: none !important;
        /* 너비 제한 해제 */
    }

    /* 버튼 내부 줄바꿈 허용 */
    .mode-btn br {
        display: block;
    }

    /* 설명 텍스트 크기 축소 */
    .mode-btn span {
        font-size: 0.65rem !important;
    }
}

.start-logo {
    display: block;
    /* 블록 요소로 변경하여 마진 오토 적용 */
    margin: 0 auto 20px auto;
    /* 가로 중앙 정렬 */
    width: 100%;
    max-width: 90%;
    /* 모바일: 화면 가로 90%까지 키움 */
    height: auto;
    max-height: 300px;
    /* 모바일: 세로 300px까지 키움 */
    object-fit: contain;
}

/* PC 화면 (가로 768px 이상) */
@media (min-width: 768px) {
    .start-logo {
        max-width: 800px;
        /* PC: 가로 최대 800px */
        max-height: 400px;
        /* PC: 세로 최대 400px */
        margin-bottom: 40px;
        /* 버튼과 간격 넓힘 */
    }

    .start-btn-group {
        flex-direction: row;
        /* PC: 가로 배치 */
        max-width: 1000px;
        gap: 20px;
    }

    .mode-btn {
        width: 200px !important;
        height: auto;
        /* PC에서는 버튼 키우기 */
    }
}

.mode-btn {
    padding: 20px;
    font-size: 1.1rem;
    font-weight: bold;
    border: 2px solid #ffd700;
    background: rgba(0, 0, 0, 0.8);
    /* 명시적인 검은 배경 */
    color: #ffd700;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
    width: 80%;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: normal;
}

.mode-btn.player-btn {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.mode-btn:hover {
    transform: scale(1.05);
    /* box-shadow: 0 0 15px rgba(255, 215, 0, 0.5); */
    /* Remove background change to avoid weird effects behind images */
    background: transparent !important;
    border-color: transparent !important;
}

.mode-btn.player-btn:hover {
    /* background: #218838; */
    /* box-shadow: 0 0 15px rgba(40, 167, 69, 0.5); */
    background: transparent !important;
}

/* 블러 처리를 위한 메인 래퍼 */
#app-root {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    transition: filter 0.3s ease;
    overflow: hidden;
}

body.blind-active #app-root {
    filter: blur(15px);
    pointer-events: none;
}

header {
    text-align: center;
    padding: max(8px, env(safe-area-inset-top)) 0 8px 0;
    background: var(--ns-bg-secondary, #111827);
    flex-shrink: 0;
    border-bottom: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    z-index: 100;
    position: relative;
}

h1 {
    margin: 0;
    font-size: 1.1rem;
    color: #ffd700;
}

/* --- Timer & Date Display (New) --- */
.timer-area {
    width: 100%;
    background: var(--ns-bg-secondary, #111827);
    padding: 10px 0;
    border-bottom: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 50;
    position: relative;
}

.timer-bar-container {
    width: 98%;
    height: 40px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    border-radius: var(--ns-radius-md, 10px);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

.timer-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--ns-accent-cyan), var(--ns-accent-purple), #ff00aa, var(--ns-accent-gold));
    background-size: 300% 100%;
    animation: gradientMove 3s ease infinite;
    transition: width 1s linear;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

@keyframes gradientMove {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.date-display {
    font-size: 3rem;
    /* Significantly larger */
    font-weight: 900;
    /* Extra bold */
    color: #fff;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.7);
    margin-bottom: 5px;
    /* Spacing */
}

.year-badge {
    background: #ffd700;
    color: #000;
    padding: 4px 12px;
    border-radius: 8px;
    margin-right: 15px;
    font-size: 2rem;
    /* Significantly larger */
    vertical-align: middle;
}

/* --- Content --- */
.container {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 5px;
    overflow-y: auto;
    gap: 5px;
    padding-bottom: 80px;
    /* footer 높이만큼 여백 확보 (30px NEWS바 + 여유) */
}

/* Viewer mode: smaller footer, less padding needed */
body.viewer-mode .container {
    padding-bottom: 80px !important;
    /* footer 고정 시 여백 필요 */
}

.status-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    flex-shrink: 0;
}

.status-board.fewer-stocks {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

.stock-card {
    background: var(--ns-gradient-card, linear-gradient(145deg, #1c2333 0%, #111827 100%));
    padding: 8px 4px;
    border-radius: var(--ns-radius-sm, 6px);
    text-align: center;
    border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 70px;
    transition: border-color var(--ns-transition-fast, 0.15s ease), box-shadow var(--ns-transition-fast, 0.15s ease);
}

.stock-card:hover {
    border-color: var(--ns-accent-cyan, #00f0ff);
    box-shadow: var(--ns-glow-cyan, 0 0 12px rgba(0, 240, 255, 0.3));
}

.stock-number {
    position: absolute;
    top: 5px;
    left: 5px;
    /* Background set dynamically */
    color: #fff;
    /* Text color white */
    font-size: 0.9rem;
    /* Larger font */
    font-weight: bold;
    width: 24px;
    /* Larger size */
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.stock-name {
    font-size: 0.8rem;
    color: #fff !important;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    width: 100%;
}

.stock-price {
    font-size: 1rem;
    font-weight: 700 !important;
    color: var(--ns-accent-cyan, #00f0ff) !important;
    font-family: 'Noto Sans KR', sans-serif !important;
    margin-bottom: 0;
    text-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}

.up {
    color: var(--ns-color-up, #ff3366);
    text-shadow: 0 0 6px rgba(255, 51, 102, 0.3);
}

.down {
    color: var(--ns-color-down, #3388ff);
    text-shadow: 0 0 6px rgba(51, 136, 255, 0.3);
}

.same {
    color: var(--ns-text-secondary, #8b9bb4);
}

/* 전광판 전년비 (결산 뉴스 효과) — 본딩커브 등락 아래 보조 표기 */
.stock-yoy {
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0.85;
    margin-top: 1px;
    white-space: nowrap;
}

.delisted-badge {
    background: #ff0000;
    color: white;
    padding: 1px 3px;
    border-radius: 2px;
    font-size: 0.6rem;
    display: inline-block;
}

.relisted-badge {
    background: #00cc66;
    color: white;
    padding: 1px 3px;
    border-radius: 2px;
    font-size: 0.6rem;
    animation: blink 2s infinite;
    display: inline-block;
}

.text-delisted {
    color: #555;
    text-decoration: line-through;
}

.chart-box {
    background: var(--ns-bg-card, #161b2e);
    padding: 5px;
    border-radius: var(--ns-radius-md, 10px);
    flex-grow: 1;
    border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1));
    position: relative;
    min-height: 200px;
    display: flex;
    box-shadow: var(--ns-shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.3));
}

canvas {
    width: 100% !important;
    height: 100% !important;
}

/* --- Footer --- */
.floating-footer {
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
    background: var(--ns-glass-bg, rgba(22, 27, 46, 0.85));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    box-shadow: var(--ns-shadow-float, 0 -4px 20px rgba(0, 0, 0, 0.5));
    display: none;
    flex-direction: column;
    flex: 0 0 auto;
    min-height: 30px;
    padding-bottom: env(safe-area-inset-bottom);
}

/* 모드가 활성화되었을 때만 하단 바 표시 */
body.admin-mode .floating-footer,
body.tv-mode .floating-footer,
body.viewer-mode .floating-footer {
    display: flex;
}


.news-ticker-container {
    height: 30px;
    background: rgba(0, 240, 255, 0.06);
    border-top: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    border-bottom: 1px solid var(--ns-border-subtle, rgba(255, 255, 255, 0.06));
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
    z-index: 2001;
}

.ticker-label {
    background: var(--ns-gradient-accent, linear-gradient(135deg, #00f0ff, #bd00ff));
    color: #000;
    font-weight: bold;
    padding: 0 10px;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 2;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.ticker-content {
    display: inline-block;
    padding-left: 100%;
    animation: ticker 30s linear infinite;
    color: #fff;
    font-size: 0.85rem;
    line-height: 30px;
}

.news-item {
    margin-right: 30px;
}

.news-up {
    color: var(--ns-color-up, #ff3366);
}

.news-down {
    color: var(--ns-color-down, #3388ff);
}

@keyframes ticker {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

.controls {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 2002;
}

/* Modified for Identical Layout */
.tv-mode .controls,
.viewer-mode .controls {
    /* 관전/송출 모드에서는 하단 바(회색바) 자체를 제거하고 NEWS만 남김 */
    display: none !important;
}

.tv-mode .controls button,
.viewer-mode .controls button,
.tv-mode .controls .button-group,
.viewer-mode .controls .button-group {
    visibility: hidden !important;
    /* Hide buttons but keep layout space if needed, or display:none if we just want the bar */
    display: none !important;
    /* Actually, we want to hide them completely to avoid clicking, but keep the bar height? 
                               No, user wants "Copy Everything". The best way is to keep the bar structure. */
}

/* Ensure Round Display is Visible */
/* Ensure Round Display is HIDDEN explicitly as per user request */
.tv-mode #round-display-group,
.viewer-mode #round-display-group {
    display: none !important;
}

.tv-mode #round-display,
.viewer-mode #round-display {
    display: none !important;
}

#round-display {
    margin: 0;
    font-size: 1rem;
    color: #fff;
    font-weight: bold;
    white-space: nowrap;
}

.button-group {
    display: flex;
    gap: 5px;
    position: relative;
    z-index: 2003;
}

.sub-btn {
    padding: 12px 15px;
    font-size: 0.9rem;
    border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1));
    border-radius: var(--ns-radius-md, 10px);
    cursor: pointer;
    color: var(--ns-text-primary, #e0e6ed);
    background: var(--ns-bg-elevated, #1c2333);
    white-space: nowrap;
    flex: 1;
    touch-action: manipulation;
    transition: all var(--ns-transition-fast, 0.15s ease);
}

.sub-btn:hover {
    border-color: var(--ns-accent-cyan, #00f0ff);
    box-shadow: var(--ns-glow-cyan, 0 0 12px rgba(0, 240, 255, 0.3));
}

.sub-btn:active {
    transform: scale(0.97);
}

.info-btn {
    background: linear-gradient(135deg, var(--ns-accent-blue, #0066ff), #0044cc);
    border-color: transparent;
}

.main-btn {
    padding: 12px 20px;
    font-size: 1.1rem;
    border: none;
    border-radius: var(--ns-radius-md, 10px);
    cursor: pointer;
    font-weight: bold;
    color: white;
    background: var(--ns-gradient-success, linear-gradient(135deg, #00e676, #00c853));
    box-shadow: 0 2px 10px rgba(0, 230, 118, 0.25);
    white-space: nowrap;
    flex: 1;
    touch-action: manipulation;
    transition: all var(--ns-transition-fast, 0.15s ease);
    letter-spacing: 0.5px;
}

.main-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 230, 118, 0.35);
}

.main-btn:active {
    transform: scale(0.97);
}

.main-btn:disabled {
    background: #2a2a3a;
    cursor: not-allowed;
    color: var(--ns-text-tertiary, #5c6b7f);
    box-shadow: none;
    transform: none;
}

@media (max-width: 768px) {
    .controls {
        gap: 8px;
        padding: 8px;
    }

    .button-group {
        flex: 1.5;
    }

    #round-display-group {
        flex: 0.8;
        background: var(--ns-bg-elevated, #1c2333);
        border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1));
        border-radius: var(--ns-radius-sm, 6px);
        padding: 5px 0;
    }
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--ns-bg-card, #161b2e);
    padding: 15px;
    border-radius: var(--ns-radius-lg, 14px);
    border: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--ns-text-primary, #e0e6ed);
    margin: auto;
    box-shadow: var(--ns-shadow-lg, 0 8px 32px rgba(0, 0, 0, 0.6));
}

/* 테마 선택 모달 전용 스타일 */
#theme-modal .modal-content {
    max-width: 420px;
    padding: 18px;
    background: var(--ns-bg-card, #161b2e);
    border: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    border-radius: var(--ns-radius-lg, 14px);
    box-shadow: var(--ns-shadow-lg, 0 8px 32px rgba(0, 0, 0, 0.6));
    height: auto;
    max-height: 80vh;
}

@media (max-width: 768px) {
    .modal-content {
        width: 98%;
        max-height: 85vh !important;
        height: auto !important;
        padding: 10px;
        overflow-y: auto;
    }

    /* 모바일: 설정 영역이 밀리지 않도록 스크롤 처리 */
    .scenario-panel {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 설정 입력 필드 크기 조정 */
    .scenario-panel input[type="number"] {
        min-width: 40px;
    }
}

.close-btn {
    align-self: center;
    /* 중앙 정렬로 변경 */
    background: none;
    border: none;
    color: #aaa;
    font-size: 32px;
    /* 24px → 32px로 증가 */
    cursor: pointer;
    padding: 10px 15px;
    /* 클릭 영역 확대 */
    min-width: 50px;
    /* 최소 너비 설정 */
    min-height: 50px;
    /* 최소 높이 설정 */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    color: #fff;
    transform: scale(1.2);
    /* 호버 시 더 크게 */
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.scenario-panel {
    background: #2a2a2a;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    border: 1px solid #444;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .scenario-panel {
        padding: 8px;
        gap: 6px;
    }

    .scenario-panel input[type="number"] {
        font-size: 14px !important;
        padding: 6px !important;
    }
}

.scenario-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.scenario-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 80px;
}

.scenario-select {
    background: #444;
    color: white;
    border: 1px solid #666;
    padding: 8px;
    border-radius: 5px;
    font-size: 0.9rem;
    width: 100%;
}

.radio-group {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #333;
    padding: 5px 10px;
    border-radius: 5px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    color: #ccc;
}

.radio-label input:checked+span {
    color: #ffd700;
    font-weight: bold;
}

.stock-control-btn {
    background: #555;
    color: white;
    border: 1px solid #777;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.stock-control-btn:hover {
    background: #777;
}

.ai-btn-row {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    flex-direction: row;
}

.ai-gen-btn {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: white;
    border: none;
    font-weight: bold;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    flex: 1;
}

.table-wrapper {
    flex-grow: 1;
    overflow: auto;
    border: 1px solid #444;
    margin-bottom: 10px;
    background: #1a1a1a;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 600px;
}

th,
td {
    border: 1px solid #444;
    padding: 6px;
    text-align: center;
    color: #ddd;
    font-size: 0.85rem;
    white-space: nowrap;
}

.keyword-input {
    width: 90%;
    background: #444;
    color: #ffd700;
    font-weight: bold;
    border: 1px solid #666;
    cursor: pointer;
}

.keyword-input:focus {
    background: #222;
    border-color: #ffd700;
}

.keyword-input::placeholder {
    color: #888;
    font-weight: normal;
}

input {
    background: #333;
    color: white;
    border: 1px solid #555;
    text-align: center;
    padding: 5px;
    font-size: 0.85rem;
}

.prob-input {
    width: 40px;
}

.name-input {
    width: 70px;
}

.num-input {
    width: 50px;
}

.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: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.info-card {
    border: 1px solid #555;
    border-radius: 8px;
    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: 8px;
    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: 8px;
    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);
    }
}

/* --- Market Close Alert (New) --- */
.market-close-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 4px solid #ff4d4d;
    border-radius: 20px;
    padding: 30px 50px;
    z-index: 5000;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 77, 77, 0.5);
    display: none;
    /* JS로 제어 */
    flex-direction: column;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.5s;
}

.market-close-alert.show {
    display: flex;
    opacity: 1;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.market-close-text {
    color: #ff4d4d;
    font-size: 3rem;
    font-weight: 900;
    text-shadow: 0 0 10px #ff4d4d;
}

.market-close-sub {
    color: #fff;
    font-size: 1.2rem;
}

@keyframes popIn {
    from {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* --- News Modal Styles --- */
.news-modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    padding: 30px;
    border-radius: 20px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    width: 95%;
    max-width: 1400px;
    max-height: 85vh !important;
    /* 최대 높이 설정 */
    overflow-y: auto !important;
    /* 스크롤 활성화 */
    overflow-x: hidden;
    /* 가로 스크롤 방지 */
    display: flex;
    flex-direction: column;
    color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

/* 스크롤바 디자인 (다크 테마) */
.news-modal-content::-webkit-scrollbar {
    width: 8px;
}

.news-modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.news-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.5);
    border-radius: 4px;
}

.news-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.7);
}

/* 카드뉴스 닫기 버튼 투명 디자인 - 모든 클래스명 포함 */
.news-modal-close-btn,
#news-modal .close-modal-btn,
.close-btn-fixed {
    background: transparent !important;
    border: 2px solid #fff !important;
    color: #fff !important;
    box-shadow: none !important;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    align-self: center;
    transition: all 0.3s ease;
}

/* X 버튼 스타일 (고정 위치) */
.close-btn-fixed {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    z-index: 10000 !important;
}

.news-modal-close-btn:hover,
#news-modal .close-modal-btn:hover,
.close-btn-fixed:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.4) !important;
}

.news-modal-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.news-modal-header h2 {
    font-size: 2.5rem;
    font-weight: 900;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.news-modal-subtitle {
    font-size: 1.1rem;
    color: #aaa;
    margin: 0;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.news-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 20px;
    padding: 25px;
    backdrop-filter: blur(10px);
    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;
    position: relative;
    overflow: hidden;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 215, 0, 0.3);
}

.news-stock-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.news-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-content {
    font-size: 1rem;
    line-height: 1.6;
    color: #ddd;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border-left: 3px solid rgba(255, 215, 0, 0.5);
    min-height: 80px;
}

.news-percentage-display {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    padding: 20px;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.news-percentage-display.rise {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.4);
}

.news-percentage-display.fall {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 0 30px rgba(79, 172, 254, 0.4);
}

.news-percentage-icon {
    font-size: 2rem;
    margin-right: 15px;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.news-percentage-value {
    font-size: 3rem;
    font-weight: 900;
    font-family: 'Noto Sans KR', monospace;
}

.news-percentage-label {
    font-size: 1.2rem;
    margin-left: 10px;
    opacity: 0.9;
}

.reversal-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.news-modal-close-btn {
    padding: 12px 30px;
    background: transparent !important;
    /* 투명 배경 */
    border: 2px solid #fff !important;
    /* 흰색 테두리 */
    border-radius: 50px;
    color: #fff !important;
    /* 흰색 글씨 */
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    align-self: center;
    box-shadow: 0 5px 20px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.news-modal-close-btn:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.15) !important;
    /* 호버시 약간 밝게 */
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.4);
}

/* Medium screens (tablets) */
@media (max-width: 1200px) {
    .news-grid {
        grid-template-columns: repeat(3, 1fr);
        /* Tablet: 3 columns */
        gap: 18px;
    }
}

@media (max-width: 768px) {
    .news-modal-content {
        padding: 15px 10px;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        overflow-y: auto;
    }

    .news-modal-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .news-modal-header h2 {
        font-size: 1.8rem;
    }

    .news-modal-subtitle {
        font-size: 0.9rem;
    }

    .news-grid {
        grid-template-columns: 1fr;
        /* Mobile: single column */
        gap: 15px;
        margin-bottom: 20px;
    }

    .news-card {
        padding: 20px;
    }

    .news-stock-name {
        font-size: 1.3rem;
    }

    .news-stock-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .news-content {
        font-size: 0.95rem;
        padding: 12px;
        min-height: 70px;
    }

    .news-percentage-display {
        padding: 15px;
    }

    .news-percentage-icon {
        font-size: 1.5rem;
        margin-right: 10px;
    }

    .news-percentage-value {
        font-size: 2.5rem;
    }

    .news-percentage-label {
        font-size: 1rem;
    }

    .reversal-badge {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .news-modal-close-btn {
        padding: 10px 25px;
        /* 모바일에서 더 작게 */
        font-size: 0.95rem;
        width: 100%;
        max-width: 300px;
    }
}

/* Extra small screens (phones in landscape) */
@media (max-width: 480px) {
    .news-modal-content {
        padding: 15px 10px;
    }

    .news-modal-header h2 {
        font-size: 1.5rem;
    }

    .news-modal-subtitle {
        font-size: 0.85rem;
    }

    .news-card {
        padding: 15px;
    }

    .news-stock-name {
        font-size: 1.1rem;
        gap: 8px;
    }

    .news-stock-icon {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .news-content {
        font-size: 0.9rem;
        padding: 10px;
        line-height: 1.5;
    }

    .news-percentage-value {
        font-size: 2rem;
    }

    .news-percentage-icon {
        font-size: 1.3rem;
    }

    .reversal-badge {
        font-size: 0.75rem;
        padding: 5px 10px;
        top: 8px;
        right: 8px;
    }
}

/* News Modal - Market Header */
.market-header-card {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    border: 1px solid #4a90e2;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    animation: slideDown 0.5s ease-out;
}

.market-badge {
    background: #ffd700;
    color: #000;
    font-weight: 900;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 1.1rem;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.market-content {
    font-size: 1.2rem;
    line-height: 1.5;
    color: #fff;
    font-weight: 500;
}

/* Stock Card Animations */
@keyframes flashGreen {
    0% {
        background-color: rgba(255, 0, 0, 0);
    }

    50% {
        background-color: rgba(255, 0, 0, 0.3);
    }

    /* KR Red for Rise */
    100% {
        background-color: rgba(255, 0, 0, 0);
    }
}

@keyframes flashBlue {
    0% {
        background-color: rgba(0, 0, 255, 0);
    }

    50% {
        background-color: rgba(0, 0, 255, 0.3);
    }

    /* KR Blue for Fall */
    100% {
        background-color: rgba(0, 0, 255, 0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.animate-flash-red {
    animation: flashGreen 1s ease-in-out infinite;
    /* flashGreen acts as Red in KR context logic above, but let's fix naming */
}

/* Let's fix naming to avoid confusion. flashGrid -> flashUp (Red), flashBlue -> flashDown (Blue) */
@keyframes flashUp {
    0% {
        box-shadow: 0 0 0 transparent;
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 50, 50, 0.8) inset;
    }

    100% {
        box-shadow: 0 0 0 transparent;
    }
}

@keyframes flashDown {
    0% {
        box-shadow: 0 0 0 transparent;
    }

    50% {
        box-shadow: 0 0 20px rgba(50, 50, 255, 0.8) inset;
    }

    100% {
        box-shadow: 0 0 0 transparent;
    }
}

.animate-flash-red {
    animation: flashUp 1.5s infinite;
}

.animate-flash-blue {
    animation: flashDown 1.5s infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
    border: 2px solid red !important;
}

.stock-change-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.change-val {
    font-size: 1.2rem;
    font-weight: bold;
}

.change-pct {
    font-size: 0.9rem;
    opacity: 0.8;
}

.news-price-display {
    font-size: 1.5rem;
    font-weight: 900;
    text-align: right;
    margin: 5px 0;
    color: #ffd700;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
    align-self: flex-end;
}

.news-card {
    align-items: stretch !important;
    /* Override flex align */
}

/* Delist Badge */
.delist-badge {
    background: #ff0000;
    color: white;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-left: 10px;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% {
        opacity: 0.5;
    }
}

/* Enhanced Info Shop Design */
.info-card {
    border: 2px solid #444;
    border-radius: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    border-color: #ffd700;
}

.info-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    padding-bottom: 8px;
    border-bottom: 1px solid #444;
}

.reveal-box {
    position: relative;
    min-height: 80px;
    background: #333;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px dashed #555;
}

.reveal-box:hover {
    border-color: #ffd700;
    background: #3a3a3a;
}

.reveal-box .click-guide {
    display: block;
    text-align: center;
    color: #ffd700;
    font-size: 1rem;
    font-weight: 600;
    padding: 20px;
    animation: pulse 2s infinite;
}

.reveal-box .reveal-text {
    display: none;
    color: #fff;
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.reveal-box.revealed .click-guide {
    display: none;
}

.reveal-box.revealed .reveal-text {
    display: block;
}

.reveal-box.revealed {
    background: linear-gradient(135deg, #2a4858 0%, #1e3a4a 100%);
    border-style: solid;
    border-color: #4a90e2;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Improved Price Tags */
.price-tag {
    font-size: 0.9rem;
    padding: 4px 12px;
    border-radius: 20px;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.price-low {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

.price-mid {
    background: linear-gradient(135deg, #28a745, #218838);
}

.price-high {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #000;
}

.price-max {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

/* Shop Tabs Enhancement */
.shop-tab {
    padding: 12px 18px;
    background: linear-gradient(135deg, #444, #555);
    border: 2px solid transparent;
    color: #ccc;
    cursor: pointer;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.shop-tab:hover {
    background: linear-gradient(135deg, #555, #666);
    transform: translateY(-1px);
}

.shop-tab.active {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    font-weight: bold;
    border-color: #ffd700;
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.4);
}

/* Enhanced Market Briefing Readability */
.market-header-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #0f3460;
    border-radius: 15px;
    padding: 20px 25px;
    margin-bottom: 25px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.market-badge {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    font-weight: 900;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    display: inline-block;
    margin-bottom: 15px;
}

.market-content {
    font-size: 1.3rem;
    line-height: 1.8;
    color: #fff;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.3px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #ffd700;
}

/* --- 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: 15px;
    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: 25px;
    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: 10px;
    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: 20px;
    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: 10px;
    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: 15px;
    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: 24px !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: 10px !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: 8px !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: 10px !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;
}

.login-box {
    background: #111;
    border: 2px solid #ffd700;
    border-radius: 8px;
    padding: 20px;
    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;
    }
}

/* === [최종 UI 복구 및 스타일 통합] === */

/* 1. 뉴스 모달 (카드뉴스) - 스크롤 필수 (사용자 요청) */
#news-modal {
    display: flex;
    /* 상시 표시 버그 수정됨 -> script.js가 display 조절 */
    align-items: center;
    justify-content: center;
    overflow: hidden !important;
    padding: 20px !important;
}

/* 스크롤 제어의 핵심 클래스 */
.news-modal-content {
    background: #1a1a1a !important;
    width: 95% !important;
    max-width: 1400px !important;

    /* ★ 사용자 요청: 높이 제한 및 스크롤 ★ */
    max-height: 80vh !important;
    overflow-y: auto !important;
    display: block !important;
    /* flex 제거하여 스크롤 꼬임 방지 */

    padding: 15px !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    position: relative !important;
    margin: auto !important;
    box-sizing: border-box !important;

    /* 모바일 터치 스크롤 */
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
}

/* [디자인 복구] 뉴스 모달 헤더 & 버튼 스타일 */
.news-modal-header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.news-modal-header h2 {
    color: #ffd700;
    margin: 0 0 10px 0;
    font-size: 1.8rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.news-modal-subtitle {
    color: #aaa;
    font-size: 0.95rem;
    margin: 0;
}

.news-modal-close-btn {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
    border: none;
    padding: 12px 40px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
    transition: all 0.2s ease;
}

.news-modal-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.5);
    background: linear-gradient(135deg, #ffed4a, #ffbb33);
}

#news-modal .news-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 15px !important;
    height: auto !important;
    padding-bottom: 50px !important;
    /* 하단 여백 */
}


/* 2. 주식 뽑기 모달 (Opening Modal) - 인라인 스타일 대체 */
#opening-modal .modal-content {
    background: #222 !important;
    border: 2px solid #ffd700 !important;
    text-align: center !important;
    max-width: 600px !important;
    width: 90% !important;
    padding: 30px !important;
    border-radius: 20px !important;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2) !important;
}

#opening-modal h2 {
    color: #ffd700 !important;
    font-size: 2.0rem !important;
    margin-bottom: 15px !important;
    white-space: nowrap !important;
}

#slot-machine-display {
    font-size: 3rem !important;
    font-weight: bold !important;
    color: #0ff !important;
    margin: 30px 0 !important;
    min-height: 60px !important;
    text-shadow: 0 0 10px #0ff !important;
}

#opening-status {
    color: #ccc !important;
    margin-bottom: 20px !important;
    font-size: 1.2rem !important;
}

#current-player-num {
    color: #ffd700 !important;
    font-weight: bold;
}

#total-player-num {
    font-weight: bold;
}

#slot-stop-btn {
    width: 60% !important;
    max-width: 250px !important;
    height: 50px !important;
    font-size: 1.2rem !important;
    margin: 0 auto !important;
    display: block !important;
}


/* 3. 방송 송출 모달 (Broadcast Modal) - 인라인 스타일 대체 */
#broadcast-modal .modal-content {
    background: #222 !important;
    max-width: 400px !important;
}

#broadcast-modal h2 {
    color: #ffd700 !important;
    margin-bottom: 10px !important;
    font-size: 1.5rem !important;
}

#broadcast-modal p {
    color: #ccc !important;
    font-size: 0.9rem !important;
    margin-bottom: 10px !important;
    line-height: 1.4 !important;
}

#broadcast-modal .login-box {
    background: #333 !important;
    padding: 15px !important;
    border-radius: 10px !important;
    margin: 10px 0 !important;
}

#broadcast-status {
    color: #4caf50 !important;
    font-weight: bold !important;
    margin-bottom: 8px !important;
}

#broadcast-link {
    width: 100% !important;
    padding: 10px !important;
    margin-top: 5px !important;
    border: 1px solid #555 !important;
    background: #222 !important;
    color: #fff !important;
    text-align: center !important;
    font-size: 1.1rem !important;
    box-sizing: border-box !important;
}

.broadcast-controls {
    display: flex !important;
    gap: 8px !important;
    margin-top: 10px !important;
}

.viewer-count-box {
    text-align: left !important;
    color: #888 !important;
    font-size: 0.85rem !important;
    margin-top: 10px !important;
}

/* 4. 모바일 최적화 (Mobile) */
@media (max-width: 768px) {

    /* 카드뉴스 2열 강제 */
    #news-modal .news-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    /* 주식 뽑기 모달 */
    #opening-modal .modal-content {
        padding: 15px !important;
        width: 95% !important;
    }

    #opening-modal h2 {
        font-size: 1.5rem !important;
        white-space: normal !important;
        /* 줄바꿈 허용 */
    }

    #slot-machine-display {
        font-size: 2.5rem !important;
        margin: 20px 0 !important;
    }

    #slot-stop-btn {
        width: 80% !important;
        height: 44px !important;
        font-size: 1rem !important;
    }

    /* 방송 송출 모달 */
    #broadcast-modal .modal-content {
        padding: 15px !important;
    }
}

/* =========================================
   [FINAL RECOVERY PATCH] 디자인 복구 및 레이아웃 수정
   ========================================= */

/* 1. [사진1 해결] 주식 뽑기 모달 디자인 복구 */
#opening-modal .modal-content {
    background: #222 !important;
    border: 2px solid #ffd700 !important;
    border-radius: 15px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 20px !important;
}

#slot-machine-display {
    font-size: 2rem !important;
    color: #0ff !important;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.7) !important;
    margin: 20px 0 !important;
    font-weight: bold !important;
}

/* 버튼 디자인 복구 */
#opening-modal button,
#slot-stop-btn {
    background: linear-gradient(135deg, #ffd700, #ffaa00) !important;
    color: #000 !important;
    font-weight: bold !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3) !important;
}

/* 2. [사진2 해결] 송출(Broadcast) 모달 복구 */
#broadcast-modal .modal-content {
    background: #1a1a1a !important;
    border: 1px solid #444 !important;
    padding: 20px !important;
    max-width: 350px !important;
}

#broadcast-modal input {
    background: #333 !important;
    color: #fff !important;
    border: 1px solid #555 !important;
    border-radius: 5px !important;
    padding: 10px !important;
    font-size: 1.2rem !important;
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 송출 버튼 가로 배치 */
#broadcast-modal .button-row {
    display: flex !important;
    gap: 10px !important;
    margin-top: 10px !important;
}

/* 3. [사진3 해결] 모바일 뷰어 차트 꽉 채우기 (Flex Fix) */
body.viewer-mode {
    height: 100vh !important;
    /* 화면 전체 높이 고정 */
    display: flex !important;
    flex-direction: column !important;
}

body.viewer-mode #app-root {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

body.viewer-mode .container {
    flex: 1 !important;
    /* 남은 공간 모두 차지 */
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: 0 !important;
    /* 하단 여백 제거 */
    min-height: 0 !important;
    /* 자식 요소 스크롤 가능하게 */
}

body.viewer-mode .chart-box {
    flex: 1 !important;
    /* 컨테이너 안에서 꽉 차게 */
    height: auto !important;
    min-height: 0 !important;
    margin-bottom: 0 !important;
    border-radius: 0 !important;
}

/* 4 & 5. [사진4,5 해결] 카드뉴스 디자인 복구 (Flashy Style) */
.news-modal-header h2 {
    font-size: 1.8rem !important;
    background: linear-gradient(to right, #ffd700, #ffeb3b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px !important;
    text-align: center;
}

.news-modal-footer {
    text-align: center;
    padding: 20px 0;
}

/* 카드 스타일 복구 */
.news-card {
    background: #1e1e1e !important;
    border-radius: 15px !important;
    padding: 15px !important;
    border: 1px solid #333 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
}

/* 상승(Rise) 카드 */
.card-footer.rise {
    background: linear-gradient(135deg, #ff4d4d, #ff0000) !important;
    color: white !important;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

/* 하락(Fall) 카드 */
.card-footer.fall {
    background: linear-gradient(135deg, #4da6ff, #0066ff) !important;
    color: white !important;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

/* 텍스트 스타일 */
.stock-name {
    font-size: 1.1rem !important;
    font-weight: bold !important;
    color: #fff !important;
}

.stock-price {
    color: #ffd700 !important;
    font-weight: bold !important;
}


/* =========================================
   [FINAL PATCH V2] 사용자 요청 정밀 수정
   ========================================= */

/* 1. 뉴스 카드 헤더 한 줄 배치 (Flex) */
.single-line-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    padding-bottom: 10px !important;
    margin-bottom: 10px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* 요소별 비중 및 스타일 */
.single-line-header .stock-icon {
    font-size: 1.5rem !important;
    margin-right: 5px !important;
}

.single-line-header .stock-name {
    font-size: 1.1rem !important;
    font-weight: bold !important;
    color: #fff !important;
    flex: 1 !important;
    /* 이름이 남은 공간 차지 */
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    text-align: left !important;
}

.single-line-header .stock-price {
    font-size: 1rem !important;
    color: #ffd700 !important;
    white-space: nowrap !important;
}

.single-line-header .stock-diff {
    font-size: 0.9rem !important;
    margin-left: 8px !important;
    white-space: nowrap !important;
}


/* 2. 뉴스 카드 푸터 한 줄 배치 & 높이 조정 */
.single-line-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 10px !important;
    height: auto !important;
    min-height: 40px !important;
    margin-top: auto !important;
    /* 카드 하단 고정 */
}

.footer-graph {
    font-size: 1.5rem !important;
    margin: 0 !important;
    line-height: 1 !important;
}

.footer-percent {
    font-size: 1.8rem !important;
    font-weight: 800 !important;
    margin: 0 !important;
    line-height: 1 !important;
}


/* 3. 모바일 최적화 (짤림/여백 해결) */
@media (max-width: 768px) {

    /* 카드뉴스: 모바일은 1열이 가장 안전하고 가독성 좋음 */
    #news-modal .news-grid {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 5px !important;
        /* 좌우 여백 확보 */
    }

    .news-card {
        width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 15px !important;
    }

    /* 방송 모달 여백 축소 */
    #broadcast-modal .modal-content {
        padding-bottom: 25px !important;
        width: 85% !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}


/* 4. 흑우증권 타이틀 스타일 */
.opening-title-main {
    font-size: 2.8rem !important;
    background: linear-gradient(135deg, #ff0000, #ff4d4d);
    /* 강렬한 레드 계열 */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 10px 0 !important;
    text-shadow: 0 4px 15px rgba(255, 0, 0, 0.4);
    font-weight: 900 !important;
    letter-spacing: -1px;
}

.opening-title-sub {
    font-size: 1.3rem !important;
    color: #ffd700 !important;
    margin-top: 5px !important;
    font-weight: normal !important;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}


/* 5. 방송 모달 닫기 버튼 위치 (헤더 라인 우측) */
#broadcast-modal .modal-content {
    position: relative !important;
}

#broadcast-modal .close-btn {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    font-size: 2rem !important;
    width: 30px !important;
    height: 30px !important;
    line-height: 25px !important;
    padding: 0 !important;
    background: transparent !important;
    color: #fff !important;
    z-index: 10;
}


/* =========================================
   [FINAL PATCH V3] 뉴스 카드 정밀 디자인 (사용자 요청 반영)
   ========================================= */

/* 1. 모바일 뉴스 카드: 1줄에 2개 + 짤림 방지 */
@media (max-width: 768px) {
    #news-modal .news-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        padding: 0 5px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .news-card {
        width: 100% !important;
        margin-bottom: 0 !important;
        min-height: 200px !important;
        /* 최소 높이 확보 */
    }
}

/* 2. 종목명 스타일 강화 (노란색, 크게, 진하게) */
.single-line-header .stock-name {
    font-size: 1.3rem !important;
    font-weight: 800 !important;
    color: #ffd700 !important;
    /* 노란색 */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
    flex: 2 !important;
    /* 공간 더 차지 */
}

/* 3. 가격 & 등락폭 통일성 (폰트 크기 동일화) */
.single-line-header .stock-price,
.single-line-header .stock-diff {
    font-size: 0.95rem !important;
    font-weight: normal !important;
    color: #fff !important;
    /* 기본 흰색, diff는 클래스별 색상 */
    display: flex !important;
    align-items: center !important;
}

/* 4. 등락폭 색상 강제 (오리지널 클래스 활용) */
.stock-diff.plus {
    color: #ff4444 !important;
}

/* 빨강 */
.stock-diff.minus {
    color: #4444ff !important;
}

/* 파랑 */

/* 5. 푸터 라인 정리 (폰트 통일 및 라인 정렬) */
.single-line-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 8px !important;
    height: 45px !important;
}

.footer-graph {
    font-size: 1.4rem !important;
    display: flex !important;
    align-items: center !important;
}

.footer-percent {
    font-size: 1.4rem !important;
    /* 그래프 아이콘과 크기 통일 */
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    line-height: 1 !important;
}

/* 상승/하락 박스 배경색 및 텍스트 색상 확실하게 */
.card-footer.rise {
    background: linear-gradient(to bottom, #ff4d4d, #cc0000) !important;
    color: #fff !important;
}

.card-footer.fall {
    background: linear-gradient(to bottom, #4d94ff, #005ce6) !important;
    color: #fff !important;
}


/* =========================================
   [MOBILE ONLY] 모바일 전용 CSS (사용자 요청)
   ========================================= */

@media (max-width: 768px) {

    /* ===== 1. 카드뉴스 모바일 최적화 ===== */

    /* 모달 자체 여백 최소화 */
    #news-modal {
        padding: 10px !important;
    }

    .news-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }

    /* 그리드: 2열 배치, 짤림 방지 */
    #news-modal .news-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 개별 카드 크기 조정 */
    .news-card {
        width: 100% !important;
        padding: 8px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        font-size: 0.85rem !important;
    }

    /* 카드 헤더 (종목명 보이도록 최적화) */
    .single-line-header {
        display: flex !important;
        flex-direction: column !important;
        /* 세로 배치로 변경 */
        align-items: flex-start !important;
        gap: 4px !important;
        padding-bottom: 8px !important;
        margin-bottom: 8px !important;
    }

    /* 첫 번째 줄: 아이콘 + 종목명 */
    .single-line-header .stock-icon,
    .single-line-header .stock-name {
        display: inline-block !important;
        margin-right: 5px !important;
    }

    .single-line-header .stock-icon {
        font-size: 1.2rem !important;
    }

    .single-line-header .stock-name {
        font-size: 1.1rem !important;
        font-weight: 800 !important;
        color: #ffd700 !important;
        flex: none !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    /* 두 번째 줄: 가격 + 등락 */
    .single-line-header .stock-price,
    .single-line-header .stock-diff {
        font-size: 0.85rem !important;
        display: inline !important;
        margin-right: 8px !important;
    }

    /* 카드 본문 */
    .card-body {
        font-size: 0.75rem !important;
        line-height: 1.3 !important;
        padding: 5px 0 !important;
    }

    /* 푸터 (상승/하락) */
    .single-line-footer {
        height: 35px !important;
        padding: 6px !important;
        gap: 6px !important;
    }

    .footer-graph {
        font-size: 1.2rem !important;
    }

    .footer-percent {
        font-size: 1.2rem !important;
    }

    /* 뉴스 모달 헤더 */
    .news-modal-header h2 {
        font-size: 1.3rem !important;
    }

    /* 뉴스 모달 푸터 버튼 */
    .news-modal-footer {
        padding: 10px 0 !important;
    }

    .news-modal-close-btn {
        padding: 10px 30px !important;
        font-size: 1rem !important;
    }


    /* ===== 2. 주식 뽑기 모달 모바일 최적화 ===== */
    #opening-modal .modal-content {
        width: 95% !important;
        padding: 20px !important;
    }

    #slot-machine-display {
        font-size: 1.5rem !important;
        line-height: 1.4 !important;
        margin: 15px 0 !important;
        min-height: auto !important;
    }

    .opening-title-main {
        font-size: 2rem !important;
    }

    .opening-title-sub {
        font-size: 1rem !important;
    }


    /* ===== 3. 송출 모달 여백 제거 (모바일 + PC 공통) ===== */
    #broadcast-modal .modal-content {
        padding: 20px 20px 10px 20px !important;
        /* 하단 여백 대폭 축소 */
    }

    .viewer-count-box {
        margin-top: 5px !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
}

/* ===== PC/모바일 공통: 송출 모달 하단 여백 제거 ===== */
#broadcast-modal .modal-content {
    padding-bottom: 15px !important;
}


/* =========================================
   [MOBILE FIX V2] 모바일 카드뉴스 완전 재설계
   ========================================= */

@media (max-width: 768px) {

    /* ===== 뉴스 모달 크기 축소 ===== */
    #news-modal {
        padding: 5px !important;
    }

    .news-modal-content {
        width: 98% !important;
        max-width: 98% !important;
        padding: 8px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    /* 그리드: 항상 2열, 매우 작은 화면에도 유지 */
    #news-modal .news-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 5px !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 카드 크기 최적화 */
    .news-card {
        width: 100% !important;
        min-width: 0 !important;
        padding: 6px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* 헤더: 아이콘 + 종목명을 한 줄에, 가격/등락은 그 아래 */
    .single-line-header {
        display: block !important;
        padding: 5px 0 !important;
        margin-bottom: 6px !important;
    }

    /* 아이콘 + 종목명 라인 */
    .single-line-header .stock-icon {
        display: inline-block !important;
        font-size: 1rem !important;
        margin-right: 3px !important;
        vertical-align: middle !important;
    }

    .single-line-header .stock-name {
        display: inline-block !important;
        font-size: 0.9rem !important;
        font-weight: 800 !important;
        color: #ffd700 !important;
        margin: 0 !important;
        vertical-align: middle !important;
        max-width: calc(100% - 1.5rem) !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    /* 가격/등락 라인 (두 번째 줄) */
    .single-line-header .stock-price,
    .single-line-header .stock-diff {
        display: inline-block !important;
        font-size: 0.75rem !important;
        margin-right: 5px !important;
        margin-top: 3px !important;
    }

    /* 본문 */
    .card-body {
        font-size: 0.7rem !important;
        line-height: 1.2 !important;
        padding: 4px 0 !important;
        word-break: keep-all !important;
    }

    /* 푸터 */
    .single-line-footer {
        height: 32px !important;
        padding: 5px !important;
        gap: 5px !important;
        margin-top: 5px !important;
    }

    .footer-graph {
        font-size: 1.1rem !important;
    }

    .footer-percent {
        font-size: 1.1rem !important;
    }

    /* 모달 헤더 */
    .news-modal-header h2 {
        font-size: 1.2rem !important;
        margin-bottom: 8px !important;
    }

    /* 모달 푸터 버튼 */
    .news-modal-footer {
        padding: 8px 0 5px 0 !important;
    }

    .news-modal-close-btn {
        padding: 8px 25px !important;
        font-size: 0.95rem !important;
    }
}

/* 매우 작은 화면 (360px 이하) - 추가 최적화 */
@media (max-width: 400px) {
    .single-line-header .stock-name {
        font-size: 0.85rem !important;
    }

    .single-line-header .stock-price,
    .single-line-header .stock-diff {
        font-size: 0.7rem !important;
    }

    .card-body {
        font-size: 0.65rem !important;
    }

    .footer-graph,
    .footer-percent {
        font-size: 1rem !important;
    }
}

/* ===== 송출 모달 크기 축소 (PC/모바일 공통) ===== */
#broadcast-modal .modal-content {
    padding: 15px 15px 8px 15px !important;
    max-width: 350px !important;
}

#broadcast-modal h2 {
    margin-bottom: 8px !important;
}

#broadcast-modal p {
    margin-bottom: 8px !important;
}

#broadcast-modal .login-box {
    margin: 8px 0 !important;
    padding: 12px !important;
}

.viewer-count-box {
    margin-top: 5px !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

@media (max-width: 768px) {
    #broadcast-modal .modal-content {
        padding: 12px 12px 5px 12px !important;
        width: 90% !important;
        max-width: 90% !important;
    }
}


/* =========================================
   [MOBILE FIX V3] 아이콘 제거 및 송출 모달 여백 완전 제거
   ========================================= */

@media (max-width: 768px) {

    /* 모바일에서 카드뉴스 아이콘 숨기기 */
    .single-line-header .stock-icon {
        display: none !important;
    }

    /* 종목명을 첫 줄로, 최대 공간 활용 */
    .single-line-header .stock-name {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 3px !important;
    }

    /* 가격 + 등락을 같은 줄에 배치 */
    .single-line-header .stock-price {
        display: inline-block !important;
        margin-right: 8px !important;
    }

    .single-line-header .stock-diff {
        display: inline-block !important;
    }
}

/* 송출 모달 여백 강제 제거 (최종) */
#broadcast-modal .modal-content {
    padding: 12px 15px 5px 15px !important;
    margin: 0 !important;
}

#broadcast-modal .login-box {
    margin: 5px 0 !important;
    padding: 10px !important;
}

.viewer-count-box {
    margin: 5px 0 0 0 !important;
    padding: 0 !important;
}

/* 모바일에서도 동일 */
@media (max-width: 768px) {
    #broadcast-modal .modal-content {
        padding: 10px 12px 3px 12px !important;
    }
}


/* =========================================
   [MOBILE FIX V4] 한 줄 배치 강제 및 송출 모달 최종 수정
   ========================================= */

@media (max-width: 768px) {

    /* 모바일 카드뉴스: 종목명/가격/등락을 한 줄로 */
    .single-line-header {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
        flex-wrap: nowrap !important;
        padding: 4px 0 !important;
        margin-bottom: 5px !important;
    }

    /* 종목명 */
    .single-line-header .stock-name {
        flex: 0 1 auto !important;
        font-size: 0.85rem !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 45% !important;
    }

    /* 가격 */
    .single-line-header .stock-price {
        flex: 0 0 auto !important;
        font-size: 0.75rem !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    /* 등락 */
    .single-line-header .stock-diff {
        flex: 0 0 auto !important;
        font-size: 0.75rem !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }
}

/* 송출 모달 강제 축소 (전체) */
#broadcast-modal .modal-content {
    min-height: auto !important;
    height: auto !important;
    padding: 10px 15px 8px 15px !important;
}

#broadcast-modal h2 {
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
}

#broadcast-modal p {
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
}

#broadcast-modal .login-box {
    margin: 8px 0 5px 0 !important;
    padding: 10px !important;
}

#broadcast-modal .viewer-count-box {
    margin: 5px 0 0 0 !important;
    padding: 0 0 3px 0 !important;
}


/* =========================================
   [LAYOUT FIX V5] 차트 짤림 현상 & 레이아웃 재구성 (Flexbox)
   ========================================= */

/* 1. 기본 레이아웃 (PC/Mobile 공통: Viewer Mode) */
body.viewer-mode {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.viewer-mode #app-root {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    flex: 1 !important;
    overflow: hidden !important;
}

/* 헤더 고정 (크기 유지) */
body.viewer-mode header {
    flex: 0 0 auto !important;
}

/* 컨테이너: 남은 공간 모두 차지 + 스크롤 방지 */
body.viewer-mode .container {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
    min-height: 0 !important;
    /* Flex item shrink fix */
}

/* 상단 상태보드 (크기 유지) */
body.viewer-mode .status-board {
    flex: 0 0 auto !important;
}

/* 차트 박스: 남은 공간 모두 차지 (핵심) */
body.viewer-mode .chart-box {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 캔버스 */
body.viewer-mode canvas#stockChart {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* 푸터 고정 (가장 하단) */
body.viewer-mode .floating-footer {
    flex: 0 0 auto !important;
    position: relative !important;
    /* fixed 제거하고 flex flow에 참여 */
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    z-index: 100 !important;
    background: #000 !important;
    /* 배경색 확보 */
}


/* 2. 모바일 (운영 모드 & Viewer 공통) */
@media (max-width: 768px) {

    /* 운영 모드도 Flexbox 적용 */
    body {
        display: flex;
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    #app-root,
    .wrapper-div-if-exists {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* 컨테이너 flex 전환 */
    .container {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
        padding-bottom: 0 !important;
        /* 하단 패딩 제거 */
        overflow: hidden !important;
    }

    .status-board {
        flex-shrink: 0 !important;
    }

    /* 차트 영역 확보 */
    .chart-box {
        flex: 1 !important;
        height: auto !important;
        min-height: 0 !important;
        margin-bottom: 0 !important;
    }

    #myChart,
    #stockChart {
        height: 100% !important;
    }

    /* 푸터 및 컨트롤 패널 */
    footer,
    .controls,
    .floating-footer {
        flex-shrink: 0 !important;
        position: relative !important;
        bottom: auto !important;
        padding-bottom: env(safe-area-inset-bottom, 10px) !important;
        /* 아이폰 하단 바 대응 */
    }
}


/* =========================================
   [모바일 차트 짤림 최종 긴급 패치]
   ========================================= */

@media (max-width: 768px) {
    /* 강제로 푸터를 화면 하단에 고정하고 차트 영역 높이를 계산 */

    body {
        height: 100vh !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #app-root {
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .container {
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        height: auto !important;
    }

    .chart-box {
        flex: 1 1 auto !important;
        height: auto !important;
        min-height: 0 !important;
        /* 중요: flex 자식의 최소 높이 리셋 */
        display: flex !important;
        flex-direction: column !important;
    }

    canvas#myChart,
    canvas#stockChart {
        flex: 1 !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* 하단 푸터 영역 고정 */
    footer,
    .controls,
    .floating-footer {
        flex: 0 0 auto !important;
        position: relative !important;
        z-index: 9999 !important;
        padding-bottom: env(safe-area-inset-bottom, 5px) !important;
        background: #111 !important;
    }

    /* 뉴스 티커 등 기타 요소가 차트를 가리지 않게 */
    .news-ticker-container {
        margin-top: 0 !important;
    }
}


/* =========================================
   [MOBILE UI UX FIX] 운영모드 카드뉴스 가림 해결
   ========================================= */

@media (max-width: 768px) {

    /* 모바일 운영모드에서 뉴스 모달 중앙 정렬 복구 (기존 상단 정렬 제거) */
    #news-modal {
        align-items: center !important;
        /* 중앙 정렬 */
        padding-top: 0 !important;
        z-index: 10000 !important;
    }

    /* 모달 컨텐츠 중앙 배치 및 적절한 여백 */
    .news-modal-content {
        margin: auto !important;
        margin-bottom: auto !important;
        max-height: 85vh !important;
    }

    /* 하단 푸터(컨트롤바) : z-index 낮춤 (모달보다 아래로) */
    .floating-footer {
        z-index: 900 !important;
        /* 모달(10000)보다 낮게 */
    }

    /* 하단 푸터 내부: 년차 표시(회색바) 숨김 */
    #round-display-group {
        display: none !important;
    }

    /* 하단 푸터 내부: 버튼 그룹 3x2 그리드 배치 */
    .controls {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        /* 3열 */
        gap: 5px !important;
        padding: 5px !important;
        height: auto !important;
        flex-wrap: wrap !important;
    }

    /* 기존 flex 구조 무력화 및 그리드 아이템화 */
    .controls .button-group {
        display: contents !important;
        /* 자식 요소들이 직접 그리드 셀이 됨 */
    }

    /* 버튼 크기 꽉 채우기 */
    .controls button {
        width: 100% !important;
        margin: 0 !important;
        height: 45px !important;
        /* 터치하기 좋은 높이 */
        font-size: 0.9rem !important;
    }
}

/* Viewer/TV Mode Safe Area Fix */
.tv-mode .floating-footer,
.viewer-mode .floating-footer {
    padding-bottom: env(safe-area-inset-bottom);
}

/* ========== TV 송출 모드 사이버펑크 스타일 ========== */

body.tv-mode {
    background: #03050a !important;
}

/* 배경 그리드 */
body.tv-mode::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0,243,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,243,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* 스캔라인 */
body.tv-mode::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 2px,
        rgba(0,0,0,0.07) 2px, rgba(0,0,0,0.07) 4px
    );
    z-index: 0;
    animation: admin-scan 10s linear infinite;
}

/* 타이머 헤더 */
body.tv-mode .timer-area {
    background: rgba(3,5,10,0.95) !important;
    border-bottom: 1px solid rgba(0,243,255,0.2) !important;
    padding: 10px 15px !important;
    backdrop-filter: blur(8px);
    position: relative;
    z-index: 10000;
}
body.tv-mode .timer-area::before {
    content: 'MARKET LIVE';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: rgba(0,243,255,0.3);
    pointer-events: none;
}
body.tv-mode .date-display {
    font-family: 'Orbitron', sans-serif !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #e0f4ff !important;
    letter-spacing: 0.06em !important;
    text-shadow: 0 0 12px rgba(0,243,255,0.4) !important;
}
body.tv-mode .year-badge {
    background: rgba(255,184,0,0.15) !important;
    border: 1px solid rgba(255,184,0,0.5) !important;
    color: #ffb800 !important;
    padding: 3px 10px !important;
    border-radius: 0 !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    box-shadow: 0 0 10px rgba(255,184,0,0.2) !important;
}
body.tv-mode .timer-bar-container {
    background: rgba(0,0,0,0.5) !important;
    border: 1px solid rgba(0,243,255,0.15) !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    height: 6px !important;
}
body.tv-mode .timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #00f3ff, #b026ff, #ff00aa, #ffb800) !important;
    background-size: 300% 100% !important;
    animation: neonGradient 3s ease infinite !important;
    box-shadow: 0 0 10px rgba(0,243,255,0.6) !important;
}

/* 주식 카드 */
body.tv-mode .stock-card {
    background: rgba(8,12,20,0.85) !important;
    border: 1px solid rgba(0,243,255,0.12) !important;
    border-top: 2px solid rgba(0,243,255,0.25) !important;
    border-radius: 0 !important;
    backdrop-filter: blur(4px);
}
body.tv-mode .stock-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 3px,
        rgba(0,243,255,0.008) 3px, rgba(0,243,255,0.008) 4px
    );
    pointer-events: none;
}
body.tv-mode .stock-card .stock-name  { color: rgba(255,255,255,0.82) !important; font-weight: 600 !important; }
body.tv-mode .stock-card .stock-price { color: #00f3ff !important; font-weight: 700 !important; text-shadow: 0 0 10px rgba(0,243,255,0.5) !important; }
body.tv-mode .stock-card .up          { color: #ff4d6d !important; text-shadow: 0 0 8px rgba(255,77,109,0.6) !important; font-weight: 700 !important; }
body.tv-mode .stock-card .down        { color: #4d9fff !important; text-shadow: 0 0 8px rgba(77,159,255,0.6) !important; font-weight: 700 !important; }

/* 차트 박스 */
body.tv-mode .chart-box {
    background: rgba(4,8,18,0.9) !important;
    border: 1px solid rgba(0,243,255,0.15) !important;
    border-top: 2px solid rgba(0,243,255,0.25) !important;
    border-radius: 0 !important;
    box-shadow: 0 0 30px rgba(0,243,255,0.05) !important;
}

/* 뉴스 티커 */
body.tv-mode .floating-footer {
    background: rgba(2,4,10,0.96) !important;
    backdrop-filter: blur(12px) !important;
    border-top: 1px solid rgba(0,243,255,0.18) !important;
}
body.tv-mode .news-ticker-container {
    background: rgba(0,243,255,0.03) !important;
    border-bottom: 1px solid rgba(0,243,255,0.1) !important;
    border-top: none !important;
}
body.tv-mode .ticker-label {
    background: transparent !important;
    border-right: 1px solid rgba(0,243,255,0.2) !important;
    color: #00f3ff !important;
    font-family: 'Orbitron', sans-serif !important;
    font-size: 0.62rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.15em !important;
    border-radius: 0 !important;
}
body.tv-mode .ticker-content {
    color: rgba(255,255,255,0.55) !important;
    font-size: 0.82rem !important;
}

/* [Mobile Optimization] Reduce Chart Area */
@media (max-width: 768px) {

    /* Restore Admin Global Chart to 200px (or keep default behavior effectively) */
    .chart-box {
        min-height: 200px !important;
        padding: 5px !important;
        flex-grow: 1 !important;
        height: auto !important;
    }

    /* Apply reduction ONLY to Viewer/Player Mode */
    .viewer-mode .chart-box {
        min-height: 50px !important;
        padding: 2px !important;
        flex-grow: 0 !important;
        height: 50px !important;
    }

    .status-board .stock-card {
        height: 65px !important;
        min-height: 65px !important;
        max-height: 65px !important;
        padding: 3px 2px !important;
    }

    .stock-number {
        width: 14px !important;
        height: 14px !important;
        font-size: 0.5rem !important;
    }
}

/* Player Selection Grid */
.player-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
}

.player-grid-btn {
    background: #333;
    border: 1px solid #555;
    padding: 8px;
    /* Reduced from 15px */
    border-radius: 5px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    /* min-height removed or reduced to avoid large buttons */
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    /* Fixed compact height */
}

.player-grid-btn:hover {
    background: #444;
    border-color: #ffd700;
}

/* [Mobile Modal Fix] Ensure modals are above the fixed header */
.modal,
#ledger-modal,
#transfer-modal,
#stock-selection-modal,
#player-selection-modal,
#player-list-modal,
#player-detail-modal,
#transaction-history-modal {
    z-index: 100005 !important;
}

/* [Ledger Scroll Fix] Prevent modal from expanding endlessly */
#ledger-list,
#history-table-body {
    max-height: 50vh;
    /* Limit height to 50% of viewport */
    overflow-y: auto;
    /* Enable vertical scrolling */
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on mobile */
    border: 1px solid #444;
    /* Optional visual boundary */
    border-radius: 5px;
    padding: 5px;
}

/* === 전체화면 플로팅 버튼 === */
.fullscreen-btn {
    position: fixed;
    right: 20px;
    bottom: 100px;
    /* footer(~80px) + 여유 */
    width: 50px;
    height: 50px;
    background: rgba(255, 215, 0, 0.6);
    /* 반투명 골드 */
    border: 2px solid rgba(255, 215, 0, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2500;
    /* NEWS바(1999)보다 높고 모달(3000)보다 낮게 */
    transition: all 0.3s ease;
    font-size: 1.5rem;
    color: #000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.fullscreen-btn:hover {
    opacity: 1;
    background: rgba(255, 215, 0, 1);
    transform: scale(1.1);
}

.fullscreen-btn:active {
    transform: scale(0.95);
}

/* 홈 화면 앱(standalone)·이미 전체화면이면 버튼이 불필요 → 숨김 */
@media (display-mode: standalone), (display-mode: fullscreen) {
    .fullscreen-btn { display: none !important; }
}
/* iOS는 사파리가 진짜 전체화면을 지원하지 않아(주소창 숨김 불가) 버튼이 무의미 → 숨김 */
body.is-standalone .fullscreen-btn,
body.is-ios .fullscreen-btn { display: none !important; }

/* 모바일 환경: 버튼 위치 조정 (safe-area 고려) */
@media (max-width: 768px) {
    .fullscreen-btn {
        right: 15px;
        bottom: calc(100px + env(safe-area-inset-bottom));
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
}

/* 전체화면 모드일 때 버튼 아이콘 변경 (선택사항) */
body:fullscreen .fullscreen-btn::before,
body:-webkit-full-screen .fullscreen-btn::before,
body:-moz-full-screen .fullscreen-btn::before {
    content: "⤓";
    /* 전체화면 해제 아이콘 */
}

/* === 모바일 설정창 스타일 === */
@media (max-width: 768px) {

    /* 설정창 모바일 최적화 */
    #admin-modal .scenario-panel>div[style*="display:flex"][style*="flex-wrap:wrap"] {
        gap: 10px !important;
        row-gap: 10px !important;
    }

    /* 각 설정 항목을 균등하게 배치 (3개씩 1줄) */
    #admin-modal .scenario-panel>div[style*="display:flex"]>div {
        flex: 1 1 30% !important;
        min-width: 110px !important;
        justify-content: center !important;
    }

    /* 모드 선택을 별도 줄로 (width 100%) */
    #admin-modal .scenario-panel>div[style*="display:flex"]>div:last-child {
        flex: 1 1 100% !important;
        margin-left: 0 !important;
        border-left: none !important;
        border-top: 1px solid #555 !important;
        padding-left: 0 !important;
        padding-top: 10px !important;
        justify-content: center !important;
        gap: 15px !important;
    }

    /* 라벨 간격 확보로 줄바꿈 방지 */
    #admin-modal .scenario-panel label.radio-label {
        padding: 0 10px !important;
        white-space: nowrap !important;
    }

    /* 타이머, 종목, 라운드 아이콘과 라벨 크기 조정 */
    #admin-modal .scenario-panel span[style*="font-size:0.85rem"] {
        font-size: 1rem !important;
    }

    #admin-modal .scenario-panel span[style*="font-size:0.8rem"] {
        font-size: 0.75rem !important;
    }

    /* 버튼 터치 영역 확대 */
    #admin-modal .stock-control-btn {
        min-width: 32px !important;
        min-height: 32px !important;
        font-size: 1rem !important;
    }

    /* 라운드 숫자 표시 */
    #admin-modal #round-display-value {
        min-width: 32px !important;
        font-size: 1rem !important;
    }
}

/* =========================================
   Game Result Modal (Liquidation Value)
   ========================================= */
.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 99999;
    padding: 16px 0;
    box-sizing: border-box;
}

.result-modal-content-new {
    width: 92%;
    max-width: 600px;
    margin: 0 auto;
    background: linear-gradient(135deg, #1e1e2f, #2a2a40);
    border-radius: 16px;
    border: 2px solid #00d2ff;
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.3);
    overflow: hidden;
}

.result-header-new {
    padding: 20px 20px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.result-title {
    font-size: 1.6rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px #00d2ff;
}

.result-subtitle {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
}

.result-footer-new {
    padding: 14px 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.result-close-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #555, #333);
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}
.result-close-btn:hover { opacity: 0.85; }

.result-modal-content {
    background: linear-gradient(135deg, #1e1e2f, #2a2a40);
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
    border: 2px solid #00d2ff;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.result-header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
    padding-bottom: 15px;
    flex-shrink: 0;
}

.result-header h2 {
    font-size: 2em;
    color: #fff;
    text-shadow: 0 0 10px #00d2ff;
    margin: 0;
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
    flex-grow: 1;
}

.result-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s;
}

.result-card.rank-1 {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    transform: scale(1.02);
}

.result-card.rank-2 {
    background: rgba(192, 192, 192, 0.2);
    border-color: #c0c0c0;
}

.result-card.rank-3 {
    background: rgba(205, 127, 50, 0.2);
    border-color: #cd7f32;
}

.rank-badge {
    font-size: 1.5em;
    font-weight: bold;
    width: 40px;
    text-align: center;
    color: #fff;
}

.rank-1 .rank-badge {
    color: #ffd700;
    text-shadow: 0 0 10px #ffd700;
}

.rank-2 .rank-badge {
    color: #c0c0c0;
    text-shadow: 0 0 10px #c0c0c0;
}

.rank-3 .rank-badge {
    color: #cd7f32;
    text-shadow: 0 0 10px #cd7f32;
}

.player-info {
    flex-grow: 1;
    text-align: left;
    margin-left: 15px;
}

.player-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    margin-bottom: 4px;
}

.player-assets {
    font-size: 0.85em;
    color: #aaa;
    display: flex;
    flex-direction: column;
}

.asset-detail {
    font-size: 0.8em;
    opacity: 0.8;
}

.total-score {
    font-size: 1.2em;
    font-weight: bold;
    color: #00d2ff;
    text-align: right;
    min-width: 100px;
}

.result-footer {
    margin-top: 20px;
    flex-shrink: 0;
}

.restart-btn {
    background: #00d2ff;
    color: #000;
    border: none;
    padding: 12px 40px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
}

.restart-btn:hover {
    background: #fff;
    box-shadow: 0 0 30px #00d2ff;
    transform: scale(1.05);
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}


/* ==========================================================================
   Result Modal (Restored)
   ========================================================================== */
.result-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.result-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(255, 215, 0, 0.3);
    animation: slideUp 0.4s ease;
}

.result-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ffd700;
}

.result-header h2 {
    font-size: 2rem;
    color: #ffd700;
    margin: 0;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.result-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #444;
    border-radius: 10px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-card:hover {
    transform: translateX(5px);
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.rank-badge {
    font-size: 1.5rem;
    font-weight: bold;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #555;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.result-card.rank-1 {
    border-color: #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 193, 7, 0.1));
}

.result-card.rank-1 .rank-badge {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    font-size: 1.8rem;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.result-card.rank-2 {
    border-color: #c0c0c0;
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.15), rgba(192, 192, 192, 0.05));
}

.result-card.rank-2 .rank-badge {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #000;
    font-size: 1.6rem;
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.5);
}

.result-card.rank-3 {
    border-color: #cd7f32;
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.15), rgba(205, 127, 50, 0.05));
}

.result-card.rank-3 .rank-badge {
    background: linear-gradient(135deg, #cd7f32, #e9a868);
    color: #fff;
    font-size: 1.6rem;
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.5);
}

.player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
}

.player-assets {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.asset-detail {
    font-size: 0.85rem;
    color: #aaa;
    line-height: 1.4;
}

.total-score {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
    text-align: right;
    flex-shrink: 0;
    min-width: 150px;
}

.result-card.rank-1 .total-score {
    font-size: 1.8rem;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.result-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #444;
}

.restart-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(135deg, #e0a800, #b38600);
    color: white;
    transition: all 0.3s ease;
}

.restart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .result-modal-content {
        padding: 20px;
        width: 95%;
        max-height: 90vh;
    }

    .result-header h2 {
        font-size: 1.5rem;
    }

    .result-card {
        padding: 12px 15px;
        gap: 10px;
    }

    .rank-badge {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .player-name {
        font-size: 1.1rem;
    }

    .asset-detail {
        font-size: 0.75rem;
    }

    .total-score {
        font-size: 1.2rem;
        min-width: 100px;
    }

    .result-card.rank-1 .total-score {
        font-size: 1.4rem;
    }
}


/* Toggle Table Button */
/* Toggle Table Button - Enhanced Design */
/* 시나리오 에디터 — 모드 안내 / 연도별 조작 지정 */
.ed-mode-note {
    background: rgba(0, 240, 255, 0.06);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 6px;
    padding: 7px 10px;
    margin-bottom: 10px;
    color: #7fd8e8;
    font-size: 0.68rem;
    line-height: 1.5;
}

.ed-mark-status {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 7px;
    color: #bbb;
    font-size: 0.7rem;
}

.ed-mark-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 5px;
}

.ed-mark {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border: 1px solid #3a3a4a;
    border-radius: 999px;
    color: #999;
    font-size: 0.66rem;
    cursor: pointer;
    user-select: none;
}

.ed-mark input {
    width: 13px;
    height: 13px;
    cursor: pointer;
    margin: 0;
}

.ed-mark.bait {
    border-color: rgba(168, 85, 247, 0.45);
    color: #c084fc;
}

.ed-mark.ta {
    border-color: rgba(77, 171, 247, 0.45);
    color: #4dabf7;
}

.ed-mark.tb {
    border-color: rgba(255, 107, 107, 0.45);
    color: #ff6b6b;
}

/* 불러온 시나리오의 플레이 모드 고정 안내 (게임 옵션 영역 상단에 동적 삽입) */
.scen-mode-lock {
    display: none;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    color: #ffd700;
    font-size: 0.76rem;
    line-height: 1.5;
}

.toggle-table-btn {
    width: 110px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #000;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    margin-left: auto;
    display: block;
}

.toggle-table-btn:hover {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(79, 172, 254, 0.4);
}

.toggle-table-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Stock Count Styles */
.stock-count-control {
    display: flex;
    align-items: center;
    gap: 3px;
}

.stock-label {
    font-size: 0.8rem;
    color: #ccc;
    margin-right: 2px;
}

.stock-count {
    font-size: 0.85rem;
    color: #fff;
    min-width: 35px;
    text-align: center;
    font-weight: bold;
    background: #333;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #555;
    margin: 0 2px;
}

.stock-control-btn {
    background: #444;
    color: white;
    border: 1px solid #666;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.stock-control-btn:hover {
    background: #555;
    border-color: #888;
}

/* =========================================
   [NEW] 개선된 관리자 설정 모달 스타일
   ========================================= */

/* 관리자 모달 기본 스타일 */
#admin-modal .modal-content {
    background: #1a1a24 !important;
    border: 2px solid #ffd700 !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8) !important;
}

/* 관리자 모달 헤더 */
#admin-modal .admin-header {
    border-radius: 10px 10px 0 0;
}

#admin-modal .admin-header h3 {
    color: #ffd700;
}

/* 관리자 모달 스크롤바 */
#admin-modal .modal-content>div:nth-child(2)::-webkit-scrollbar {
    width: 6px;
}

#admin-modal .modal-content>div:nth-child(2)::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#admin-modal .modal-content>div:nth-child(2)::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 3px;
}

#admin-modal .modal-content>div:nth-child(2)::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.5);
}

/* 관리자 모달 버튼 호버 효과 */
#admin-modal .sub-btn {
    transition: all 0.2s ease;
    border: none !important;
}

#admin-modal .sub-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

#admin-modal .sub-btn:active {
    transform: translateY(0);
}

#admin-modal .main-btn {
    transition: all 0.2s ease;
    border: none !important;
}

#admin-modal .main-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.5);
    filter: brightness(1.1);
}

#admin-modal .main-btn:active {
    transform: translateY(0);
}

/* 종목 수 조절 버튼 */
#admin-modal .stock-control-btn {
    transition: all 0.15s ease;
}

#admin-modal .stock-control-btn:hover {
    transform: scale(1.1);
}

#admin-modal .stock-control-btn:active {
    transform: scale(0.95);
}

/* 관리자 모달 모바일 반응형 */
@media (max-width: 768px) {
    #admin-modal .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
    }

    #admin-modal .modal-content>div:nth-child(2) {
        padding: 10px !important;
        max-height: 75vh !important;
    }

    /* 게임 옵션 - 한 줄 유지 (절대 세로 배치 안함) */
    #game-options-section>div {
        flex-wrap: nowrap !important;
        flex-direction: row !important;
    }

    /* 관리 도구 그리드 - 2열 유지 */
    #admin-modal [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* API 설정 영역 */
    #admin-modal #api-key-area>div {
        flex-direction: column !important;
    }

    #admin-modal #api-key-area [style*="min-width: 150px"],
    #admin-modal #api-key-area [style*="min-width: 180px"] {
        min-width: auto !important;
        width: 100% !important;
    }

    /* 버튼 터치 영역 확대 */
    #admin-modal .sub-btn,
    #admin-modal .main-btn {
        min-height: 44px !important;
    }

    /* 입력 필드 터치 친화적 - 게임옵션 제외 */
    #admin-modal input[type="number"]:not(#timer-duration-input) {
        min-height: 36px !important;
    }

    #admin-modal select {
        min-height: 40px !important;
    }
}

/* 관리자 모달 작은 화면 추가 조정 */
@media (max-width: 400px) {
    #admin-modal .admin-header h3 {
        font-size: 0.95rem !important;
    }

    #admin-modal .admin-header h3 span:first-child {
        font-size: 1.1rem !important;
    }

    #admin-modal [style*="font-size: 0.9rem"] {
        font-size: 0.8rem !important;
    }

    #admin-modal [style*="font-size: 0.85rem"] {
        font-size: 0.75rem !important;
    }

    /* 게임 옵션 라벨 숨기기 (아이콘만 표시) */
    #game-options-section span[style*="color: #ffd700"] {
        display: none !important;
    }
}

/* =========================================
   [NEW] 종목 상세 설정 테이블 개선
   ========================================= */

#admin-table-container {
    padding: 12px;
    background: #1a1a24;
}

#admin-table-container table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 3px;
    font-size: 0.9rem;
}

#admin-table-container thead tr:first-child th {
    background: linear-gradient(135deg, #2a2a3a, #1a1a2e) !important;
    padding: 12px !important;
    border-radius: 8px 8px 0 0;
}

#admin-table-container thead tr:nth-child(2) th {
    background: #2a2a3a;
    color: #ffd700;
    padding: 10px 6px;
    font-weight: bold;
    font-size: 0.85rem;
    border-bottom: 2px solid #ffd700;
}

/* 연도 키워드 헤더 (1년, 2년...) */
#admin-table-container thead tr:nth-child(2) th:nth-child(n+5) {
    background: linear-gradient(135deg, #3d3d5c, #2a2a4a);
    min-width: 60px;
}

#admin-table-container tbody tr {
    transition: background 0.2s;
}

#admin-table-container tbody tr:hover {
    background: rgba(255, 215, 0, 0.15);
}

#admin-table-container tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
}

#admin-table-container tbody td {
    padding: 8px 6px;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid #333;
}

/* 종목 번호 */
#admin-table-container tbody td:first-child {
    background: #2a2a3a;
    color: #ffd700;
    font-weight: bold;
    font-size: 1rem;
    width: 35px;
    border-radius: 6px 0 0 6px;
}

/* 종목 이름 입력 - 크게! */
#admin-table-container .name-input {
    width: 120px !important;
    padding: 10px 8px !important;
    background: #1e1e28 !important;
    border: 2px solid #555 !important;
    color: #fff !important;
    border-radius: 6px !important;
    font-size: 1rem !important;
    font-weight: bold !important;
    text-align: center !important;
}

#admin-table-container .name-input:focus {
    border-color: #ffd700 !important;
    outline: none !important;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4) !important;
    background: #252530 !important;
}

/* 숫자 입력 (시작가, 변동) */
#admin-table-container .num-input {
    width: 70px !important;
    padding: 8px 4px !important;
    background: #252530 !important;
    border: 1px solid #444 !important;
    color: #4fc3f7 !important;
    border-radius: 5px !important;
    font-size: 0.9rem !important;
    text-align: center !important;
}

#admin-table-container .num-input:focus {
    border-color: #4fc3f7 !important;
    outline: none !important;
    box-shadow: 0 0 8px rgba(79, 195, 247, 0.4) !important;
}

/* 확률 입력 (1~7) - JavaScript에서 색상 동적 적용 */
#admin-table-container .prob-input {
    width: 42px !important;
    padding: 8px 4px !important;
    border: 2px solid #555 !important;
    border-radius: 6px !important;
    font-size: 1rem !important;
    font-weight: bold !important;
    text-align: center !important;
    transition: all 0.15s ease !important;
    cursor: pointer;
}

#admin-table-container .prob-input:focus {
    outline: none !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6) !important;
    transform: scale(1.15);
}

#admin-table-container .prob-input:hover {
    transform: scale(1.08);
}

/* 키워드 입력 - 크게! */
#admin-table-container .keyword-input {
    width: 80px !important;
    padding: 8px 4px !important;
    background: rgba(255, 215, 0, 0.1) !important;
    border: 2px dashed #666 !important;
    color: #ffd700 !important;
    border-radius: 5px !important;
    font-size: 0.9rem !important;
    font-weight: bold !important;
    text-align: center !important;
}

#admin-table-container .keyword-input:focus {
    border-style: solid !important;
    border-color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.2) !important;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3) !important;
}

#admin-table-container .keyword-input::placeholder {
    color: #888 !important;
    font-weight: normal !important;
}

/* 테이블 범례 */
#admin-table-container::before {
    content: "📊 확률: 1(급락) ~ 4(보합) ~ 7(급등)";
    display: block;
    padding: 10px 15px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #4c2525, #292524, #1a472a);
    color: #ccc;
    font-size: 0.85rem;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
}

/* PC 모드 - 컴팩트하게 조정 */
@media (min-width: 769px) {
    #admin-modal .modal-content {
        max-width: 95vw !important;
        width: 1530px !important;
    }

    #admin-table-container {
        padding: 10px;
    }

    #admin-table-container table {
        border-spacing: 2px;
    }

    #admin-table-container .name-input {
        width: 100px !important;
        font-size: 0.85rem !important;
        padding: 6px 5px !important;
    }

    #admin-table-container .keyword-input {
        width: 65px !important;
        font-size: 0.8rem !important;
        padding: 5px 3px !important;
    }

    #admin-table-container .num-input {
        width: 55px !important;
        font-size: 0.8rem !important;
        padding: 5px 3px !important;
    }

    #admin-table-container .prob-input {
        width: 36px !important;
        font-size: 0.85rem !important;
        padding: 5px 3px !important;
    }

    #admin-table-container thead tr:nth-child(2) th {
        font-size: 0.75rem;
        padding: 6px 4px;
    }

    #admin-table-container tbody td {
        padding: 5px 4px;
    }

    #admin-table-container::before {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
}

/* 테이블 모바일 최적화 */
@media (max-width: 768px) {
    #admin-table-container {
        padding: 8px;
    }

    #admin-table-container table {
        font-size: 0.8rem;
        border-spacing: 2px;
    }

    #admin-table-container .name-input {
        width: 70px !important;
        font-size: 0.85rem !important;
        padding: 6px 4px !important;
    }

    #admin-table-container .num-input {
        width: 50px !important;
        font-size: 0.8rem !important;
        padding: 5px 2px !important;
    }

    #admin-table-container .prob-input {
        width: 30px !important;
        font-size: 0.85rem !important;
        padding: 5px 2px !important;
    }

    #admin-table-container .keyword-input {
        width: 55px !important;
        font-size: 0.75rem !important;
        padding: 5px 2px !important;
    }

    #admin-table-container thead tr:nth-child(2) th {
        padding: 6px 3px;
        font-size: 0.7rem;
    }

    #admin-table-container tbody td:first-child {
        font-size: 0.85rem;
        width: 25px;
    }

    #admin-table-container::before {
        font-size: 0.7rem;
        padding: 6px 10px;
    }
}

/* ============================================
   NEW GAME RESULT MODAL (Improved UI/UX)
   ============================================ */

.result-modal-content-new {
    background: linear-gradient(180deg, #0d1117 0%, #161b22 100%);
    border: 2px solid #ffd700;
    border-radius: 20px;
    padding: 0;
    max-width: 420px;
    width: 92%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(255, 215, 0, 0.2), 0 0 100px rgba(255, 215, 0, 0.1);
    animation: resultModalSlideUp 0.5s ease;
    display: flex;
    flex-direction: column;
}

@keyframes resultModalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.result-header-new {
    background: linear-gradient(135deg, #1a1a2e 0%, #0d1117 100%);
    padding: 20px 30px;
    text-align: center;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.result-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin-bottom: 5px;
}

.result-subtitle {
    font-size: 0.8rem;
    color: #888;
}

/* Podium Section */
.result-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
    padding: 30px 20px 20px;
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.05) 0%, transparent 100%);
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease;
}

.podium-place:hover {
    transform: translateY(-5px);
}

.podium-medal {
    font-size: 2.5rem;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.podium-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-score {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.podium-base {
    width: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: rgba(0, 0, 0, 0.8);
    border-radius: 8px 8px 0 0;
}

/* 1st place */
.podium-1 .podium-score {
    color: #ffd700;
}

.podium-1 .podium-base {
    height: 80px;
    background: linear-gradient(180deg, #ffd700 0%, #b8860b 100%);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

/* 2nd place */
.podium-2 .podium-score {
    color: #c0c0c0;
}

.podium-2 .podium-base {
    height: 60px;
    background: linear-gradient(180deg, #c0c0c0 0%, #808080 100%);
    box-shadow: 0 0 20px rgba(192, 192, 192, 0.4);
}

/* 3rd place */
.podium-3 .podium-score {
    color: #cd7f32;
}

.podium-3 .podium-base {
    height: 45px;
    background: linear-gradient(180deg, #cd7f32 0%, #8b4513 100%);
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.4);
}

/* Table Section */
.result-table-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 15px 15px;
    max-height: 45vh;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.result-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.result-table th {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    color: #ffd700;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    border-bottom: 2px solid #ffd700;
    white-space: nowrap;
}

.result-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    transition: background 0.2s ease;
}

.result-table tbody tr:hover {
    background: rgba(255, 215, 0, 0.1);
}

/* Column styles */
.col-rank {
    width: 40px;
    font-weight: 700;
    font-size: 0.95rem;
}

.col-name {
    text-align: left !important;
    font-weight: 600;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-bonus {
    width: 60px;
}

.col-bonus.has-bonus {
    color: #4ade80 !important;
    font-weight: 600;
}

.col-total {
    font-weight: 700;
    color: #ffd700 !important;
    text-align: right !important;
}

/* Top 3 row styles */
.rank-1-row {
    background: rgba(255, 215, 0, 0.15) !important;
}

.rank-1-row td {
    border-color: rgba(255, 215, 0, 0.3);
}

.rank-1-row .col-total {
    color: #ffd700 !important;
    font-size: 1rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.rank-2-row {
    background: rgba(192, 192, 192, 0.1) !important;
}

.rank-2-row .col-total {
    color: #c0c0c0 !important;
}

.rank-3-row {
    background: rgba(205, 127, 50, 0.1) !important;
}

.rank-3-row .col-total {
    color: #cd7f32 !important;
}

/* Footer */
.result-footer-new {
    padding: 15px 20px;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    display: flex;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.result-close-btn {
    padding: 12px 40px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border: 2px solid #ffd700;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.result-close-btn:hover {
    background: linear-gradient(135deg, #ffd700 0%, #f59e0b 100%);
    color: #000;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .result-modal-content-new {
        width: 95%;
        max-width: 380px;
        max-height: 95vh;
        border-radius: 15px;
    }

    .result-header-new {
        padding: 12px 15px;
    }

    .result-title {
        font-size: 1.3rem;
    }

    .result-podium {
        padding: 15px 10px 10px;
        gap: 5px;
    }

    .podium-medal {
        font-size: 1.8rem;
    }

    .podium-name {
        font-size: 0.75rem;
        max-width: 65px;
    }

    .podium-score {
        font-size: 0.65rem;
    }

    .podium-base {
        width: 65px;
        font-size: 1.1rem;
    }

    .podium-1 .podium-base {
        height: 55px;
    }

    .podium-2 .podium-base {
        height: 40px;
    }

    .podium-3 .podium-base {
        height: 30px;
    }

    .result-table-container {
        max-height: 45vh;
        padding: 0 8px 8px;
    }

    .result-table {
        font-size: 0.75rem;
    }

    .result-table th {
        padding: 8px 5px;
        font-size: 0.7rem;
    }

    .result-table td {
        padding: 8px 5px;
    }

    .col-rank {
        width: 32px;
        font-size: 0.85rem;
    }

    .col-name {
        max-width: 70px;
    }

    .col-bonus {
        width: 50px;
    }

    .result-close-btn {
        padding: 10px 25px;
        font-size: 0.85rem;
    }
}

@media (max-width: 400px) {
    .result-modal-content-new {
        width: 98%;
        max-width: 350px;
    }

    .result-title {
        font-size: 1.1rem;
    }

    .podium-base {
        width: 55px;
    }

    .result-table {
        font-size: 0.7rem;
    }

    .col-name {
        max-width: 60px;
    }

    .col-bonus {
        width: 45px;
        font-size: 0.65rem;
    }
}

/* 긴급속보 배너 */
.breaking-news-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999998;
    background: rgba(6, 2, 12, 0.92);
    border-bottom: 2px solid #ff003c;
    color: #fff;
    text-align: center;
    padding: 11px 20px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    box-shadow: 0 0 30px rgba(255,0,60,0.35), inset 0 0 40px rgba(255,0,60,0.05);
    backdrop-filter: blur(6px);
    animation: breakingFlash 0.8s ease-in-out infinite alternate;
}
.breaking-news-banner::before {
    content: '⚠ BREAKING';
    display: inline-block;
    background: #ff003c;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    padding: 2px 8px;
    margin-right: 12px;
    vertical-align: middle;
    box-shadow: 0 0 10px rgba(255,0,60,0.6);
}
@keyframes breakingFlash {
    0%   { border-bottom-color: #ff003c; box-shadow: 0 0 30px rgba(255,0,60,0.35), inset 0 0 40px rgba(255,0,60,0.05); }
    100% { border-bottom-color: #ff6688; box-shadow: 0 0 50px rgba(255,0,60,0.55), inset 0 0 60px rgba(255,0,60,0.1); }
}

/* ===== 시나리오 라이브러리 팝업 — 디자인 시스템(--ns-) 정렬 ===== */
.ns-pop-overlay {
    position: fixed; inset: 0; z-index: 100010;
    display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ns-pop-overlay.stacked { z-index: 100014; }
.ns-pop-card {
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(0, 240, 255, 0.06), transparent 60%),
        linear-gradient(160deg, var(--ns-bg-elevated, #1c2333), var(--ns-bg-card, #161b2e) 55%);
    border: 1px solid var(--ns-border-accent, rgba(0, 240, 255, 0.2));
    border-radius: var(--ns-radius-lg, 14px);
    box-shadow: var(--ns-shadow-lg, 0 8px 32px rgba(0, 0, 0, 0.6)), 0 0 0 1px rgba(0, 240, 255, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    color: var(--ns-text-primary, #e0e6ed);
    width: 96%; max-width: 460px; max-height: 88vh; overflow-y: auto; padding: 18px;
}
.ns-pop-card.narrow { max-width: 420px; }
.ns-pop-title {
    text-align: center; color: var(--ns-accent-cyan, #00f0ff); margin: 0 0 6px;
    font-size: 1.1rem; font-weight: bold; letter-spacing: 0.02em;
    text-shadow: 0 0 14px rgba(0, 240, 255, 0.35);
}
.ns-pop-title.gold { color: var(--ns-accent-gold, #ffd700); text-shadow: 0 0 14px rgba(255, 215, 0, 0.35); }
.ns-pop-sub { color: var(--ns-text-secondary, #8b9bb4); font-size: 0.74rem; text-align: center; margin-bottom: 14px; line-height: 1.5; }
.ns-pop-item {
    background: linear-gradient(160deg, var(--ns-bg-elevated, #1c2333), rgba(22, 27, 46, 0.6));
    border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1));
    border-radius: var(--ns-radius-md, 10px); padding: 11px 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ns-pop-item:hover { border-color: var(--ns-border-accent, rgba(0, 240, 255, 0.2)); box-shadow: 0 0 16px rgba(0, 240, 255, 0.08); }
.ns-pop-label { color: var(--ns-text-secondary, #8b9bb4); font-size: 0.76rem; display: block; margin-bottom: 4px; }
.ns-input, .ns-textarea {
    width: 100%; box-sizing: border-box; padding: 9px;
    background: var(--ns-bg-input, rgba(0, 0, 0, 0.3));
    border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1));
    color: var(--ns-text-primary, #e0e6ed);
    border-radius: var(--ns-radius-sm, 6px);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ns-input:focus, .ns-textarea:focus {
    outline: none; border-color: var(--ns-accent-cyan, #00f0ff);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.12);
}
.ns-textarea { resize: vertical; }
.ns-btn { border: none; border-radius: var(--ns-radius-sm, 6px); font-weight: bold; cursor: pointer; padding: 10px; font-size: 0.85rem; transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease; }
.ns-btn:hover { filter: brightness(1.08); }
.ns-btn:active { transform: translateY(1px); }
.ns-btn-primary { background: linear-gradient(135deg, var(--ns-accent-blue, #0066ff), var(--ns-accent-cyan, #00f0ff)); color: #001018; box-shadow: 0 2px 14px rgba(0, 240, 255, 0.28); }
.ns-btn-gold { background: linear-gradient(135deg, #b8860b, var(--ns-accent-gold, #ffd700)); color: #111; box-shadow: 0 2px 14px rgba(255, 215, 0, 0.25); }
.ns-btn-ghost { background: var(--ns-bg-elevated, #1c2333); border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1)); color: var(--ns-text-secondary, #8b9bb4); }
.ns-btn-danger { background: rgba(255, 51, 102, 0.12); border: 1px solid rgba(255, 51, 102, 0.4); color: #ff6b8a; }
.ns-btn-tab { flex: 1; padding: 9px; border-radius: var(--ns-radius-md, 10px); border: 1px solid var(--ns-border-default, rgba(255, 255, 255, 0.1)); background: var(--ns-bg-elevated, #1c2333); color: var(--ns-text-secondary, #8b9bb4); font-weight: bold; font-size: 0.85rem; cursor: pointer; transition: all 0.15s ease; }
.ns-btn-tab.active { border-color: var(--ns-accent-cyan, #00f0ff); background: rgba(0, 240, 255, 0.1); color: var(--ns-accent-cyan, #00f0ff); box-shadow: 0 0 16px rgba(0, 240, 255, 0.18), inset 0 0 12px rgba(0, 240, 255, 0.06); }
.ns-pop-blind-box { position: relative; border: 1px solid var(--ns-border-default, rgba(255,255,255,0.1)); border-radius: var(--ns-radius-md, 10px); padding: 12px; background: var(--ns-bg-primary, #0b0b15); overflow: hidden; }
.ns-pop-cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(11, 11, 21, 0.55); border-radius: var(--ns-radius-md, 10px); }