/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:#dae6e6;
	/* background: linear-gradient(135deg, #f0f4ff 0%, #f5f0ff 25%, #fff0f5 50%, #fff5f0 75%, #f0fff5 100%);*/
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
}

/* 모든 애니메이션과 트랜지션 제거 */
*, *::before, *::after {
    animation: none !important;
    transition: none !important;
}

/* 상단 네비게이션 */
.top-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 100%;
    margin: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    padding: 6px 14px;
    min-height: 52px;
    height: auto;
    width: 100%;
    box-sizing: border-box;
}

/* 한 줄 구성: 데스크톱에서 자식이 .nav-container의 flex 항목처럼 배치 */
.nav-top-row {
    display: contents;
}

.nav-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.nav-brand i {
    margin-right: 8px;
    color: #666;
}

.nav-menu {
    display: flex;
    gap: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    text-decoration: none;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    min-width: 80px;
}

.nav-item:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.nav-item.active {
    color: #333;
    border-bottom-color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.nav-item i {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.nav-item span {
    font-size: 0.8rem;
    font-weight: 500;
}

/* 상단 nav: 모바일도 시계를 검색창 왼쪽(order). 데스크톱은 order로 로고·시계·검색 순 */
.nav-clock {
    flex-shrink: 0;
    margin: 0 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.menu-toggle {
    display: none;
    flex-shrink: 0;
    font-size: 1.15rem;
    color: #666;
    cursor: pointer;
    padding: 4px 6px;
    margin-left: 2px;
}
.menu-toggle:hover {
    color: #333;
}

@media (max-width: 1024px) {
    .top-nav {
        padding: 0;
    }

    .nav-container {
        flex-direction: column;
        align-items: stretch;
        padding: 3px 6px 4px;
        min-height: 0;
    }

    /* 모바일: 로고 | 시계 | 검색(가변 폭) | 햄버거(맨 오른쪽) */
    .nav-top-row {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        width: 100%;
        min-height: 40px;
        gap: 0;
    }

    .nav-brand {
        order: 0;
        width: auto;
        padding: 0;
        flex-shrink: 0;
    }

    .nav-brand img {
        height: 38px !important;
    }

    .nav-top-row-fill {
        order: 1;
        display: flex;
        flex: 1 1 auto;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        min-width: 0;
        gap: 6px;
        margin: 0 4px 0 6px;
    }

    .nav-top-row-fill .nav-search-box {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
        margin: 0 !important;
        order: 2;
    }

    .nav-top-row-fill .nav-clock {
        position: static;
        flex: 0 0 auto;
        align-self: center;
        z-index: auto;
        margin: 0 !important;
        padding: 0;
        font-size: 0.68rem !important;
        font-weight: 600;
        line-height: 1.2;
        color: #555;
        white-space: nowrap;
        pointer-events: none;
        max-width: none;
        text-align: left;
        order: 1;
    }

    .nav-search-box input {
        padding: 5px 28px 5px 8px;
        font-size: 0.8rem;
    }

    .menu-toggle {
        order: 2;
        flex-shrink: 0;
        display: block !important;
    }

    .nav-menu-wrapper .nav-menu {
        display: none;
    }

    .nav-menu-wrapper.active .nav-menu {
        display: flex;
    }

    .nav-menu-wrapper {
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        z-index: 999;
        max-height: 0;
        overflow: hidden;
        width: 100%;
    }

    .nav-menu-wrapper.active {
        max-height: 500px;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        padding: 8px 0;
    }

    .nav-item {
        flex-direction: row;
        justify-content: flex-start;
        padding: 10px 16px;
        min-width: auto;
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-item i {
        margin-right: 12px;
        margin-bottom: 0;
        font-size: 1.15rem;
    }

    .nav-item span {
        font-size: 0.88rem;
    }

    .search-icons {
        display: block !important;
    }
}

@media (min-width: 1025px) {
    /* .nav-top-row-fill 은 display:contents → 검색·시계가 상위 플렉스에 직접 참여 */
    .nav-top-row-fill {
        display: contents;
    }

    /* 화면: 로고 → 시계 → 검색 → 메뉴 */
    .nav-brand {
        order: 0;
    }

    .nav-clock {
        order: 1;
    }

    .nav-search-box {
        order: 2;
    }

    .menu-toggle {
        order: 3;
        display: none !important;
    }

    .nav-menu-wrapper {
        order: 4;
    }

    .search-icons {
        display: none !important;
    }

    .nav-search-box input {
        padding-right: 1rem;
    }

    .nav-menu-wrapper .nav-menu {
        display: flex;
    }

    .nav-menu-wrapper {
        position: static;
        max-height: none !important;
        overflow: visible;
        box-shadow: none;
        flex: 0 0 auto;
        margin-left: auto;
    }
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 2px; /* 테마 영역 위·좌·우 여백 최소화 */
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* 헤더 스타일 */
header {
    text-align: center;
    margin-bottom: 15px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header h1 i {
    margin-right: 15px;
    color: #ffd700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 데모 알림 */
.demo-notice {
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid #ffc107;
    color: #856404;
    padding: 12px 20px;
    border-radius: 10px;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
    animation: pulse 2s infinite;
}

.demo-notice i {
    margin-right: 10px;
    font-size: 1.1rem;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes pulse-dot {
    0% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.5; 
        transform: scale(1.2);
    }
    100% { 
        opacity: 1; 
        transform: scale(1);
    }
}

/* 자동 갱신 상태 표시 */
.auto-update-status {
    transition: all 0.3s ease;
}

.auto-update-status .pulse-dot {
    animation: pulse-dot 1.5s infinite;
}

/* 섹터 카드 기본 스타일 - 애니메이션 제거됨 */

/* 데이터 변경 하이라이트 */
.stock-change.positive.changed {
    background: #c8e6c9;
    animation: highlight-positive 0.5s ease;
}

.stock-change.negative.changed {
    background: #ffcdd2;
    animation: highlight-negative 0.5s ease;
}

@keyframes highlight-positive {
    0% { background: #4caf50; color: white; }
    100% { background: #c8e6c9; color: #2e7d32; }
}

@keyframes highlight-negative {
    0% { background: #f44336; color: white; }
    100% { background: #ffcdd2; color: #c62828; }
}

/* 섹터 그리드 (좁은 화면 전용 가로 스크롤 래퍼는 @media max-width 480px에서 활성) */
.sector-grid-hscroll {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.sector-grid-hscroll-inner {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* 섹터 그리드 */
.sector-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
}

/* 섹터 카드 */
.sector-card {
    background: white;
    /*background:#dde7e8;*/
    border-radius: 3px;
     /*padding: 20px;*/
	padding: 1px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border: 2px solid transparent;
}

.sector-card:hover {
  /*  transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    border-color: #ddd;*/
}

/* 섹터 헤더 */
.sector-header {
    display: flex;
    flex-direction: column;
    /*padding-bottom: 10px;*/
    /* border-bottom: 1px solid #eee; 구분선 제거 */
}

.sector-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
/*	background:#06b3b9;*/
   /* background: linear-gradient(135deg, #ff7043 0%, #ff5722 100%);*/
    /*padding: 8px 12px;*/
	padding: 4px 12px;
    border-radius: 3px;
   /* border: 0px solid #e64a19;*/
    /*box-shadow: 0 2px 4px rgba(255, 112, 67, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);*/
}

.sector-title {
    display: flex;
    align-items: center;
    /*gap: 10px;*/
    flex: 1;
    min-width: 0;
}

.theme-leader-icon {
    color: #ffd700 !important;
    font-size: 1rem;
    margin-right: 4px;
    display: inline-block;
    order: -1 !important;
    flex-shrink: 0;
}

.sector-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sector-title h3 {
    font-size: 0.95rem;
	/* font-size: 1.01rem;*/
    color: #ffffff;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /*flex: 1;*/
    min-width: 0;
    order: 1 !important;
}

.sector-stats {
    text-align: right;
    flex-shrink: 0;
    margin-left: 8px;
}

.sector-value {
    font-size: 0.95rem;
    font-weight: bold;
    color: #333;
    background: #f8f8f8;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.sector-value.positive {
   /* color: #e74c3c;*/
    color: #f3080c;
 /* background: #f8f8f8;*/
  /*  background: #cef0f1;*/
     background: #ffffff;
}

.sector-value.negative {
   /* color: #1976d2;*/
    color: #193bff;
    background: #f8f8f8;
}

/* 섹터 뉴스 */
.sector-news {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #999;
}

.sector-news p {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

/* 테마이슈 미리보기 */
.theme-issue-preview {
    position: relative;
   /* padding: 8px 12px;*/
   padding: 4px 10px;
   /* margin-top: 4px;*/
    margin-top: -8px;
   /* margin-bottom: 8px;*/
	 margin-bottom: 2px;
   /* background: #f8f9fa;*/
    background: #fff2f5;
    border-radius: 6px;
    /* border-left: 3px solid #667eea; 구분선 제거 */
    font-size: 0.85rem;
    color: #333;
    transition: background 0.2s ease;
    z-index: 100;
}

.theme-issue-preview:hover {
    background: #e9ecef;
}

.theme-issue-preview[style*="cursor: pointer"] {
    cursor: pointer;
}

.theme-issue-title-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    position: relative;
    z-index: 2;
}

.theme-issue-expanded-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: block;
    background: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1003 !important;
    min-width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* 제목·더보기 한 줄(줄바꿈 없음) — 레이어 자체 flex는 다른 스타일과 충돌 시 깨질 수 있어 내부 행만 flex */
.theme-issue-expanded-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.theme-issue-expanded-title {
    flex: 0 1 auto;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
    margin-bottom: 0;
}

.theme-issue-expanded-row .theme-issue-more-btn {
    margin-top: 0;
    flex-shrink: 0;
    align-self: flex-start;
    white-space: nowrap;
}

.theme-issue-more-btn {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.theme-issue-more-btn:hover {
    background: #5568d3;
}

/* 섹터 내 주식 목록 */
.sector-stocks {
    display: flex;
    flex-direction: column;
	 /*gap: 8px;*/
    gap: 1px;
}

.sector-stock-item {
    display: flex;
    flex-direction: column;
    /*padding: 8px 12px;*/
	/*padding: 1px 10px;*/
	padding: 4px 6px 0px 3px;
    position: relative;
    z-index: 1;
   /* background: #f8f9fa;*/
    background: #fefeff;
    border-radius: 0px;
    cursor: pointer;
    border: 1px solid transparent;
    border-top: 1px solid #dddddd;
    /*gap: 4px;*/
	gap: 0px;
}

.sector-stock-item:first-child {
    border-top: none;
}

/* 상한가(.limit-up): 배경·테두리는 index_new.php 인라인 스타일에서 처리(줄무늬 유지) */

.sector-stock-item:hover {
   /* background: #e9ecef;
    border-color: #ccc;
    transform: translateX(5px);*/
}

.stock-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.stock-name {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
   /* font-size: 1.06rem;*/
	font-size: 0.95rem;
	font-weight: 500;
   /* font-weight: 600;*/
   /*color:#333;*/
	color: #2a211a;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /*gap: 0px;*/
	gap: 0px;
}

.stock-price-display {
    font-size: 0.85rem;
    color: #999;
    font-weight: 400;
}

.stock-trading-value-row {
    width: 100%;
    font-size: 0.7rem;
    color: #999;
    font-weight: 400;
    text-align: right;
}

.stock-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.1);
    color: #666;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 8px;
    flex-shrink: 0;
}

.stock-name-text {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
	padding-left: 4px; /* 새롭게 추가된 값*/
}

.stock-name-text.has-nxt {
   /* padding-top: 4px;*/
   padding-top: 1px;
}

.nxt-triangle {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 8px 0 0;
    border-color: #e74c3c transparent transparent transparent;
    z-index: 1;
}

.stock-change-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.stock-trading-value {
   /* font-size: 0.7rem;*/
   font-size: 0.95rem;
    color: #999;
    font-weight: 400;
}

.stock-change-wrapper .stock-trading-value {
   /* font-size: 0.7rem;*/
   font-size: 0.95rem;
    /*color: #999;*/
	color: #2a211a;
    font-weight: 400;
}

.stock-trading-value-inline {
    font-size: 0.7rem;
    color: #999;
    font-weight: 400;
    margin-left: 8px;
}

.stock-change-bar-container {
    width: 100%;
    height: 8px;
    /*background-color: #f0f0f0;*/
	background-color: #d7e7e7;
    border-radius: 4px;
    position: relative;
    margin: 4px 0;
    overflow: hidden;
}

.stock-change-bar-center {
    position: absolute;
    left: 50%;
    top: 0;
    width: 3px;
    height: 100%;
   /* background-color: #ddd;*/
    background-color: #000000;

    transform: translateX(-50%);
}

.stock-change-bar {
    height: 100%;
    position: absolute;
    top: 0;
    border-radius: 2px;
}

.stock-change-bar.positive {
   /* background-color: #e74c3c;*/
    background-color: #f3090c;
}

.stock-change-bar.negative {
   /* background-color: #1976d2;*/
   background-color: #173bff;
}

/* 새로운 가격 바 스타일 */
.stock-price-bar-container {
    width: 100%;
    height: 16px;
    background-color: #d7e7e7;
    border-radius: 0;
    position: relative;
    margin: 4px 0;
    overflow: hidden;
}

.stock-price-bar-center {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: #000000;
    transform: translateX(-50%);
    z-index: 3;
}

.stock-price-bar-thin {
    height: 2px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 0;
    z-index: 1;
}

.stock-price-bar-thin.positive {
    background-color: #f3090c;
}

.stock-price-bar-thin.negative {
    background-color: #173bff;
}

.stock-price-bar-thick {
    height: 12px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 0;
    z-index: 2;
}

.stock-price-bar-thick.positive {
    background-color: #f3090c;
}

.stock-price-bar-thick.negative {
    background-color: #173bff;
}

/* 가격 상세 정보 스타일 */
.stock-price-details {
    display: flex;
    gap: 8px;
    margin-top: 2px;
    padding: 0 4px;
    font-size: 0.6rem;
    color: #999;
    line-height: 1.2;
}

.price-detail-item {
    white-space: nowrap;
}

.highlight {
    background: #ffc107;
    color: #333;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.stock-change {
   /* font-size: 0.8rem;*/
   font-size: 0.95rem;
    font-weight: 600;
   /* padding: 2px 6px;*/
     padding: 0px 6px;
    border-radius: 4px;
    min-width: 60px;
    text-align: center;
}

.stock-change.positive {
   /* color: #e74c3c;*/
  /*  color: #e71909;*/
    color: #f3080c;
    background: #fdf2f2;
}

.stock-change.negative {
   /* color: #1976d2;*/
   /*color: #115bcb;*/
    color: #193bff;
    background: #e3f2fd;
}

.stock-price {
    font-size: 0.8rem;
    color: #666;
    min-width: 80px;
    text-align: right;
}

.stock-volume {
    font-size: 0.8rem;
    color: #666;
    min-width: 60px;
    text-align: right;
}

/* 빈 섹터 */
.empty-sector {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* 주식 그리드 (기존 스타일 유지) */
.stock-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* 주식 카드 */
.stock-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.stock-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    border-color: #ddd;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.stock-header h3 {
    font-size: 1.2rem;
    color: #333;
    font-weight: 600;
}

.stock-code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.stock-price {
    margin-bottom: 15px;
}

.current-price {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.price-change {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
}

.price-change.positive {
    color: #e74c3c;
    background: #fdf2f2;
}

.price-change.negative {
    color: #27ae60;
    background: #f0f9f0;
}

.stock-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.info-item {
    text-align: center;
    flex: 1;
}

.info-item .label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.info-item .value {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.stock-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #666;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.market {
    background: #e3f2fd;
    padding: 2px 6px;
    border-radius: 4px;
    color: #1976d2;
}

/* 새로고침 섹션 */
.refresh-section {
    text-align: center;
    color: white;
    margin-top: 10px;
}

.refresh-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.refresh-btn:hover {
    background: white;
    color: #333;
    transform: scale(1.05);
}

.refresh-btn i {
    margin-right: 8px;
}

.last-update {
    font-size: 0.9rem;
    opacity: 0.8;
}

.refresh-status {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 5px;
}

/* 에러 메시지 */
.error-message {
    grid-column: 1 / -1;
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.error-message i {
    font-size: 3rem;
    color: #e74c3c;
    margin-bottom: 20px;
}

.error-message p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 10px;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #666 0%, #555 100%);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
}

/* 상세 정보 스타일 */
.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #999;
    font-size: 1.2rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.detail-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #999;
}

.detail-item .label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.detail-item .value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

/* 차트 영역 */
.chart-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: center;
}

.chart-placeholder {
    height: 200px;
    background: linear-gradient(45deg, #e3f2fd, #f3e5f5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.1rem;
}

/* 반응형 디자인 */
/* 720px 이상: 3개 */
@media (min-width: 720px) {
    .sector-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* 태블릿 사이즈 이상: 하단 마진 추가 (뉴스 바가 가리지 않도록) */
@media (min-width: 1024px) {
    .container {
        padding-bottom: 80px; /* 뉴스 바 높이 + 여유 공간 */
    }
    
    .sector-grid {
        margin-bottom: 80px;
    }
}

/* 965px 이상: 4개 */
@media (min-width: 965px) {
    .sector-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* 1205px 이상: 5개 */
@media (min-width: 1205px) {
    .sector-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* 1445px 이상: 8개 */
@media (min-width: 1445px) {
    .sector-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
}

/* 기존 미디어 쿼리 유지 (하위 호환성) */
@media (max-width: 1024px) {
    .sector-grid {
        gap: 8px;
    }

    .sector-card {
	   /* padding: 16px;*/
        padding: 3px;
    }

    .sector-title h3 {
	 /* font-size: 1.0rem;*/
        font-size: 0.95rem;
    }

    .sector-value {
        /*font-size: 1.1rem;*/
		font-size: 0.95rem;
    }

    .sector-news p {
        font-size: 0.85rem;
    }

    .stock-name {
      /*  font-size: 0.85rem;*/
	  font-size: 0.95rem
    }

    .stock-change {
       /* font-size: 0.75rem;*/
	   font-size: 0.95rem;
        min-width: 55px;
    }

    .stock-price, .stock-volume {
       /* font-size: 0.75rem;*/
	   font-size: 0.95rem;
        min-width: 70px;
    }

    .sector-stock-item {
        /*padding: 7px 10px;*/
		padding: 1px 2px;
    }
    
    .stock-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .container {
        padding: 2px;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

/* 641px~1024px: 테마 3열 / 640px 이하는 2열 */
@media (min-width: 641px) and (max-width: 1024px) {
    .sector-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .container {
        padding: 2px;
        padding-bottom: 70px; /* 모바일 뉴스 바 높이 + 여유 공간 */
    }
    
    .sector-grid {
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .sector-card {
	 /*padding: 12px;*/
        padding: 3px;
    }

    .sector-title h3 {
        font-size: 0.95rem;
    }

    .sector-value {
       /* font-size: 1rem;*/
	   font-size: 0.95rem;
    }

    .sector-news p {
        font-size: 0.8rem;
    }

    .stock-name {
       /* font-size: 0.8rem;*/
	   font-size: 0.95rem
    }

    .stock-change {
        /*font-size: 0.7rem;*/
		font-size: 0.95rem;
        min-width: 50px;
    }

    .stock-price, .stock-volume {
       /* font-size: 0.7rem;*/
	   font-size: 0.95rem;
        min-width: 50px;
    }

    .sector-stock-item {
       /* padding: 6px 8px;*/
	    padding: 1px 10px;
    }
    
    .stock-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stock-card {
        padding: 15px;
    }
    
    .stock-header h3 {
        font-size: 1rem;
    }
    
    .current-price {
        font-size: 1.3rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* 좁은 뷰포트: 테마 그리드 가로 480px 고정 + 하단 가로 스크롤 */
@media (max-width: 480px) {
    .container {
        overflow-x: visible;
    }

    .sector-grid-hscroll {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    .sector-grid-hscroll-inner {
        width: 480px;
        max-width: 480px;
        box-sizing: border-box;
    }

    .sector-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    
    .sector-card {
	/*padding: 10px;*/
        padding: 3px;
    }

    .sector-title h3 {
        font-size: 0.95rem;
    }

    .sector-value {
        /*font-size: 0.9rem;*/
		font-size: 0.95rem;
    }

    .sector-news p {
        font-size: 0.7rem;
    }

    .stock-name {
       /* font-size: 0.7rem;*/
	   font-size: 0.95rem;
    }

    .stock-change {
       /* font-size: 0.8rem;*/
	   font-size: 0.95rem;
        min-width: 45px;
    }

    .stock-price, .stock-volume {
      /*  font-size: 0.8rem;*/
	  font-size: 0.95rem;
        min-width: 45px;
    }

    .sector-stock-item {
      /*  padding: 4px 6px;*/
	  padding: 1px 10px;
    }
    
    .stock-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .stock-card {
        padding: 12px;
    }
    
    .stock-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .info-item {
        text-align: left;
    }
}

/* 로딩 애니메이션 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #666;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #777;
}


.top100-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    margin-top: 24px;
}

.top100-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 18px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.top100-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
}

.top100-subtitle {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.top100-table-wrap {
    margin-top: 10px;
    max-height: calc(85vh - 200px);   /* 뷰포트 높이의 85%에서 헤더/버튼 공간 제외 */
    overflow-y: auto;
}

.top100-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.top100-table thead {
    position: sticky;
    top: 0;
    background-color: #f5f5f7;
    z-index: 1;
}

.top100-table th,
.top100-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #e5e5e5;
    text-align: right;
}

.top100-table th:nth-child(2),
.top100-table td:nth-child(2),
.top100-table th:nth-child(3),
.top100-table td:nth-child(3),
.top100-table th:nth-child(4),
.top100-table td:nth-child(4) {
    text-align: left;
}

.top100-table tbody tr:hover {
    background-color: #f9fafb;
}

.top100-table td.tv-cell {
    font-weight: 600;
}

/* 특징주 뉴스 하단 바 */
.feature-news-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    backdrop-filter: blur(10px);
    padding: 4px 15px;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 60px; /* 최소 높이 보장 */
}

.feature-news-line {
    padding: 6px 8px;
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    border-radius: 2px;
    min-height: 24px; /* 최소 높이 보장 */
    display: flex;
    align-items: center;
}

/* 첫 번째 줄 - 연한 보라색 */
#featureNewsLine1 {
    background: rgba(230, 220, 250, 0.95);
}

/* 두 번째 줄 - 더 연한 보라색/회색 */
#featureNewsLine2 {
    background: rgba(240, 235, 250, 0.9);
}

.feature-news-line:hover {
    opacity: 0.9;
}

.feature-news-line .news-time {
    color: #666;
    font-weight: 500;
    margin-right: 8px;
}

/* 확장된 특징주 뉴스 레이어 */
.feature-news-expanded {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    background: white;
    z-index: 1001;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    transition: height 0.3s ease;
    overflow: visible; /* 닫기 버튼이 위로 튀어나오도록 */
    display: flex;
    flex-direction: column;
    border-radius: 15px 15px 0 0;
}

.feature-news-expanded.active {
    height: 66.67vh; /* 화면의 약 2/3 */
}

.feature-news-expanded-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px;
    padding-top: 12px;
}

/* 닫기 버튼: 패널 위로 튀어나오게 (패널의 직접 자식일 때) */
.feature-news-expanded > .feature-news-close-btn-wrapper {
    position: absolute;
    top: -37px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    margin: 0;
    padding: 0;
}

/* 패널이 닫혀 있을 때는 닫기 버튼 숨김 */
.feature-news-expanded:not(.active) > .feature-news-close-btn-wrapper {
    visibility: hidden;
    pointer-events: none;
}

.feature-news-close-btn-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    background: transparent;
    flex-shrink: 0;
}

.feature-news-close-btn {
    font-size: 1.2rem;
    color: #333;
    cursor: pointer;
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 8px 8px 0 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
    /*box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);*/
    position: relative;
    z-index: 1;
}

.feature-news-close-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    background: #e8e8e8;
}

/* 뉴스 영역 외 오버레이 */
.feature-news-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    pointer-events: auto;
    /* 전체 화면을 덮되, 뉴스 영역(z-index: 1001)은 위에 표시됨 */
}

.feature-news-overlay.active {
    display: block;
}

.feature-news-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transition: background 0.2s ease;
    margin-bottom: 2px;
}

.feature-news-item:hover {
    background: #ff9fc9;
    border-radius: 8px;
}

.feature-news-item:hover .feature-news-item-time {
    color: #ffffff;
    font-weight: 600;
}

.feature-news-item:hover .feature-news-item-title {
    color: #ffffff;
    font-weight: 500;
}

/* 가장 최신 뉴스 (첫 번째) 스타일 - 기본 스타일 제거 */
.feature-news-item-latest {
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.feature-news-item-latest:hover {
    background: #ff9fc9;
}

.feature-news-item-latest:hover .feature-news-item-time {
    color: #ffffff;
    font-weight: 600;
}

.feature-news-item-latest:hover .feature-news-item-title {
    color: #ffffff;
    font-weight: 500;
}

/* 특징주 텍스트 색상 */
.feature-news-item-title .feature-news-keyword {
    color: #06b3b9;
}

/* 첫 번째 뉴스에서도 특징주 색상 적용 */
.feature-news-item-latest .feature-news-item-title .feature-news-keyword {
    color: #06b3b9;
}

.feature-news-item-time {
    font-size: 0.85rem;
    color: #999;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 50px;
}

.feature-news-item-title {
    font-size: 0.9rem;
    color: #333;
    line-height: 1.5;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 모바일 반응형 */
@media (max-width: 1024px) {
    .feature-news-bar {
        padding: 3px 12px;
        gap: 2px;
        min-height: 55px; /* 모바일 최소 높이 */
    }

    .feature-news-line {
        font-size: 0.8rem;
        padding: 5px 6px;
        min-height: 22px; /* 모바일 최소 높이 */
    }

    .feature-news-expanded-content {
        padding: 8px 12px;
        padding-top: 12px;
    }

    .feature-news-item {
        padding: 10px 12px;
    }

    .feature-news-item-time {
        font-size: 0.8rem;
        min-width: 45px;
    }

    .feature-news-item-title {
        font-size: 0.85rem;
    }
}
