/* ========== 공통 변수 설정 ========== */
:root {
  --primary-color: #274c77;
  --secondary-color: #f9f9f9;
  --third-color: #f9f9f9;
  --text-color: #666;
  --text-color2: #191919;
  --white: #ffffff;
  --border-color: #ddd;
  --shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  --font-family: Arial, sans-serif;
  --header-height: 4.375rem;   /* 70px */
  --padding-base: 1.25rem;     /* 20px */
  --box-radius: 0.3125rem;     /* 5px */
  --transition-speed: 0.3s;
}

/* ========== 기본 스타일 ========== */
body {
  font-family: var(--font-family);
  width: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--secondary-color);
  overflow-x: hidden;
  box-sizing: border-box;
}
*, *::before, *::after {
  box-sizing: inherit;
}

/* ========== 헤더 ========== */
header,
header * {
  box-sizing: content-box;
}

header {
  background-color: var(--primary-color);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--padding-base);
  color: var(--white);
}

.header-left {
  display: flex;
  align-items: center;
  font-family: 'esamanru Medium';
}

.header-logo {
  height: 2.7rem; /* 40px */
  margin-left: 0.3125rem; /* 5px */
  vertical-align: middle; 
  cursor: pointer;
}

header .logo {
  font-weight: bold;
  cursor: pointer;
  font-size: 1.875rem; /* 기존: 30px (30/16) */
  margin: 0.625rem;    /* 기존: 10px (10/16) */
  margin-bottom: 0;
}

header nav {
  display: flex;
  justify-content: flex-end;
  gap: 1.875rem;     /* 기존: 30px (30/16) */
  margin: 0.625rem;    /* 기존: 10px (10/16) */
  flex: 1;
}

header .header-link {
  font-family: 'Eugro L';
  color: var(--white);
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: bold;
  padding: 5px 10px; /* 호버 효과를 위한 패딩 */
  transition: background-color 0.3s ease, transform 0.3s ease;
}
header .header-link:hover {
  background-color: rgba(255, 255, 255, 0.2); /* 원하는 배경 효과 */
  border-radius: 4px;
  transform: scale(1.05);
}

h1 {
  cursor: pointer;
}

/* ========== 메인 컨테이너 ========== */
#mainContainer {
  display: grid;
  grid-template-rows: 2.8125rem 25rem 18.75rem auto auto;
  grid-template-columns: 1fr 3fr;
  gap: 0.9375rem;
  padding: var(--padding-base);
  background-color: var(--secondary-color);
  height: auto;
  font-family: 'Paperlogy';
}

/* ========== 공통 박스 스타일 ========== */
.box {
  background-color: var(--third-color);
  border-radius: var(--box-radius);
  width: 100%;
  height: auto;
  padding: 0.625rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(1.25rem);
  animation: fadeInUp 0.5s forwards;
}

/* ========== 1. 종목 검색 박스 ========== */
#stockSearchBox {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.search-wrapper {
  position: relative;
  display: inline-block; 
  width: 100%; /* 필요한 경우 크기 조절 */
}
  
#searchInput {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 1.5625rem;
  padding-right: 2.5rem;
  background-color: var(--third-color);
  color: var(--text-color);
  font-family: 'Paperlogy';
  border: 0;
  box-sizing: border-box;
}

.searchbutton {
  position: absolute;
  height: 0.9375rem;
  width: 0.9375rem;
  right: 0.3125rem;
  transform: translateY(35%); 
  vertical-align: middle; 
  cursor: pointer;
  background-color: var(--secondary-color);
}

/* ========== 2. 일수 검색 및 옵션 박스 ========== */
#daysSearchBox {
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem ;
  gap: 0.625rem ;
  color: #191919;
  z-index: 998;
}

#daysInput {
  display: none;
}

#date_label {
  font-size: 0.875rem ;
  font-weight: bold;
  color: var(--text-color);
  padding: 0.3125rem ;
  white-space: nowrap;
  font-family: 'GmarketSansMedium';
}

.chart-btn {
  width: 2rem ;
  height: 2rem ;
  border: 1px solid #ccc;       /* 옅은 테두리 */
  border-radius: 4px;           /* 약간의 둥근 모서리 */
  background-color: #f9f9f9;    /* 옅은 배경색 */
  color: #333;                  /* 글자색 */
  font-size: 1.25rem ;              /* +, - 기호가 크게 보이도록 설정 */
  cursor: pointer;              /* 클릭 가능 마우스 포인터 */
  transition: background-color 0.2s ease;
  margin: 0;                /* 버튼 간격 */
}

.chart-btn:hover {
  background-color: #f0f0f0;    /* 조금 더 진한 배경색 */
}

.chart-btn:active {
  background-color: #e0e0e0;
}

#toggleSections1 input[type="checkbox"] {
  display: none;
}

#toggleSections1 label {
  width: 6.25rem ;
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background-color: var(--secondary-color);
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: color 0.3s ease;
}

#toggleSections1 input[type="checkbox"]:checked + label {
  background-color: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

#toggleSections1 label:hover {
  background-color: #f0f0f0;
} 

#toggleSections1 label:active {
  transform: scale(0.95);
}

.daysearchrightContainer {
  display: flex;
  align-items: center;
  gap: 0.3125rem;               /* 초기화 버튼과 조회기준 간격 */
  margin-left: auto;       /* 나머지 공간을 밀어내고 오른쪽으로 이동 */
}

.resetbutton {
  height: 1.0625rem ;
  width: 1.0625rem ;
  margin: 0;
}

.question-wrapper {
  position: relative;       /* 자식 요소(.arrow_box)를 절대 위치시키기 위해 필요 */
  display: inline-block;    /* 인라인 컨텍스트에서도 말풍선을 띄울 수 있도록 함 */
  overflow: visible;        /* 말풍선이 컨테이너 밖으로 나가더라도 잘리지 않도록 함 */
}

.question {
  height: 1.0625rem ;
  width: 1.0625rem ;
  margin: 0;
  cursor: pointer;
}

.arrow_box {
  display: none;
  position: absolute;
  width: 16.875rem ;
  padding: 0.5rem 0.75rem;
  top: 120%;                /* 물음표 아래로 말풍선을 내리기 위해 top을 아이콘 높이보다 크게 설정 */
  left: 50%;                /* 부모 요소 기준 수평 가운데 정렬 */
  transform: translateX(-50%);  
  -webkit-border-radius: 8px;
  -moz-border-radius: 8px;
  border-radius: 8px;
  background: #333;
  color: #fff;
  font-size: 0.875rem ;
  text-align: center;
}

.arrow_box:after {
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 0;
  height: 0;
  margin-left: -0.625rem ;
  border: solid transparent;
  border-color: rgba(51, 51, 51, 0);
  border-bottom-color: #333;
  border-width: 0.625rem ;
  pointer-events: none;
  content: ' ';
}

.question:hover + p.arrow_box {
  display: block;
}

/* ========== 3. 종목 리스트 ========== */
#stockContainer {
  max-height: 23.625rem ;
  height: 100%;
  overflow-y: auto;
  /* border: 1px solid var(--border-color);
  border-radius: var(--box-radius); */
  background-color: var(--third-color);
}

.stockItem {  
  padding: 0.625rem ;
  /* border-bottom: 1px solid #eaeaea;*/
  cursor: pointer;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color: var(--text-color2); 
}

.stockItem:hover {
  background-color: #f0f0f0;
  transform: scale(0.98);
}

.selectedStockItem {
  background-color: var(--primary-color) !important;
  color: var(--white);
  transform: scale(1) !important;
}

/* ========== 4. 상단 차트 영역 (캔들차트) ========== */
#chartBox {
  position: relative;

}

#myChart {
  height: 28.125rem ;
  color: var(--text-color) !important;
  /* border: 1px solid var(--border-color);
  border-radius: var(--box-radius); */
}

.chart_label {
  position: absolute;
  top: 0.8125rem ;
  right: 0.9375rem ;
  font-size: 0.625rem ;
  color: var(--text-color);
  font-weight: bold;
  white-space: nowrap;
}

.ma_label {
  position: absolute;
  top: 1.9375rem ;
  right: 0.9375rem ;
  font-size: 0.625rem ;
  color: var(--text-color);
  font-weight: bold;
  white-space: nowrap;
}

.bollinger_label {
  position: absolute;
  top: 2.9375rem ;
  right: 0.9375rem ;
  font-size: 0.625rem ;
  color: var(--text-color);
  font-weight: bold;
  white-space: nowrap;
}

.envelope_label {
  position: absolute;
  top: 4rem ;
  right: 0.9375rem ;
  font-size: 0.625rem ;
  color: var(--text-color);
  font-weight: bold;
  white-space: nowrap;
}

.ichimoku_label {
  position: absolute;
  top: 5.0625rem ;
  right: 0.9375rem ;
  font-size: 0.625rem ;
  color: var(--text-color);
  font-weight: bold;
  white-space: nowrap;
}

.psar_label {
  position: absolute;
  top: 5.9375rem ;
  right: 0.9375rem ;
  font-size: 0.625rem ;
  color: var(--text-color);
  font-weight: bold;
  white-space: nowrap;
}

/* ========== 5. 옵션 체크박스 영역 ========== */
#toggleSections2 {
  height: 100%;
  /* border: 1px solid var(--border-color);
  border-radius: var(--box-radius); */
  background-color: var(--third-color);
  overflow-y: scroll;
  color: var(--text-color2);
}

#toggleSections2 input[type="checkbox"] {
  display: none; /* 기존처럼 숨기기 */
}

#toggleSections2 .indicatorItem {
  position: relative;
  display: block;
  width: 100%;
  padding: 0.625rem ;
  padding-bottom: 1.875rem ;
  /* border-bottom: 1px solid #eaeaea; */
  cursor: pointer;
  box-sizing: border-box;
}

#toggleSections2 .indicatorItem label:hover {
  transform: scale(0.98);
  background-color: #f0f0f0;
}

#toggleSections2 input[type="checkbox"]:checked + label {
  background-color: var(--primary-color);
  color: var(--white);
  transform: scale(1) !important;
}

#toggleSections2 .indicatorItem label {
  position: absolute;
  top: 0; 
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0.625rem ; /* indicatorItem과 동일하게 */
  box-sizing: border-box;
  cursor: pointer;
}

/* ========== 6. 하단 차트 영역 (보조지표 차트들) ========== */
#IndexBox {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.625rem ;
}

#volumeBox,
#tradingvalueBox,
#macdBox,
#rsiBox,
#stochBox,
#stochrsiBox,
#williamsBox,
#cciBox,
#atrBox,
#rocBox,
#uoBox,
#adxBox {
  width: 100%;
  height: 100%;
  /* border: 1px solid var(--border-color);
  border-radius: var(--box-radius); */
}

#myVolumeChart,
#tradingvalueChart,
#macdChart,
#rsiChart,
#stochChart,
#stochrsiChart,
#williamsChart,
#cciChart,
#atrChart,
#rocChart,
#uoChart,
#adxChart {
  display: none;
  width: 62.5rem ;
  display: block;
}

#chartBox canvas,
#IndexBox canvas {
  width: 100%;
  height: 100%;
}

.volume_label,
.tradingvalue_label,
.macd_label,
.rsi_label,
.stoch_label,
.stochrsi_label,
.williams_label,
.cci_label,
.atr_label,
.roc_label,
.uo_label,
.adx_label {
  position: absolute;
  top: 0.8125rem;
  right: 0.9375rem ;
  font-size: 0.625rem ;
  color: var(--text-color);
  font-weight: bold;
  white-space: nowrap;
}

/* ========== 아래 영역 (3:1) ========== */
#bottomRow1 {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr; /* 1:1 비율 */
  gap: 0.9375rem ;
  margin-top: 0x; /* 필요한 경우 여백 조절 */

}

/* ========== 7. 재무지표 영역 ========== */

#tempBox1 {
  position: relative;
  min-height: 17.5rem ;
}
#tempContainer1 {
  min-height: 17.5rem ;
  border-radius: var(--box-radius);
  display: flex;
  flex-direction: column;
}
.table-wrapper {
  /* border: 1px solid #ddd;
  border-radius: 5px; */
  overflow: hidden;
  margin: 0 auto;
}


.financial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem ;
  background-color: rgba(39, 76, 119); /* 메인 컬러 #274c77의 8% 불투명 */
  border-radius: 4px;
}
.financial-header h3,
.financial-header .unit-info {
  margin: 0;
  color: #ffffff;
}
.financial-header h3 {
  font-weight: bold;
  font-size: 1rem ;
  font-family: 'GmarketSansMedium';
}
.financial-header .unit-info {
  font-size: 0.875rem;
}


#financialTable {
  width: 100%;
  border-collapse: separate;
  border: none;
  text-align: right;
  min-width: 50rem ;
  min-height: 15.625rem ;
}
#financialTable th,
#financialTable td {
  padding: 0.625rem ;
  border: 1px solid #ddd;
  white-space: nowrap;
}
#financialTable thead th {
  background-color: #f2f2f2;
  color: #333;
  font-family: 'Paperlogy';
  font-weight: lighter;
  text-align: center;
  white-space: nowrap;
  border-bottom: 2px solid #274c77;
  padding: 0.25rem 0.5rem !important;
}
#financialTable tbody td {
  padding: 0.25rem 0.5rem !important;
  line-height: 1.2;
}
#financialTable td.negative {
  color: #d9534f;
}
#financialTable td.na-cell {
  color: #cccccc !important;
}
#financialTable tbody tr:hover {
  background-color: #f0f0f0;
}

/* ========== 8. 현금흐름 영역  ========== */
#tempBox2 {
  position: relative;
}
#undicisionedContainer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
  width: 100%;
  height: 100%;
}
#cashflowChart {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 232px;
  margin-top: 0;
  margin-bottom: 0;
}

/* ========== 아래 영역 (1:1) ========== */
#bottomRow2 {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr; /* 1:1 비율 */
  gap: 0.9375rem ;
  margin-top: 0x; /* 필요한 경우 여백 조절 */

}

/* ========== 9. 투자자 지표 ========== */
#sentimentIndexBox {
  max-height: 22rem;
}
#sentimentIndexBox .financial-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--primary-color);
  border-radius: 4px;
  margin-bottom: 0.625rem ;
}
#sentimentIndexBox .financial-header h3 {
  font-size: 1rem ;
  color: var(--white);
  margin: 0;
  font-weight: bold;
  border-radius: 4px;
}
#sentimentIndexBox .financial-header .unit-info {
  color: var(--white);
  margin: 0;
  border-radius: 4px;
}

/* 투자자 지표 좌우 컨테이너 */
.investor-indicator-container {
  display: flex;
  gap: 0.625rem ;
  min-height: 17.5rem ;
}
.investor-indicator-container > .left-indicator,
.investor-indicator-container > .right-indicator {
  flex: 1;
  background-color: var(--third-color);
  border-radius: var(--box-radius);
  padding: 0.9375rem ;
  box-shadow: var(--shadow);

}

/* 고수 인덱스 영역 (좌측) */
.gosu-index-container {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.gosu-index-container .gosu-header {
  text-align: center;
  margin-bottom: 0.9375rem ;
  font-size: 1rem ;
  color: var(--text-color2);
  font-family: 'Eugro M';
}
.gosu-footer {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem ;
  margin-left: 3.125rem ;
  gap: 3.75rem ; 
}
.footer-label {
  margin: 0 1.25rem ;
  font-size: 1rem ;
  white-space: nowrap;
  font-family: 'Eugro M';
}

/* 하수 인덱스 영역 (우측) */
.hasu-index-container {
  display: flex;
  flex-direction: column;
}
.hasu-index-container .hasu-header {
  text-align: center;
  margin-bottom: 0.625rem ;
  font-size: 1rem ;
  color: var(--text-color2);
  font-family: 'Eugro M';
}
.pie-chart-container {
  width: 13.75rem ;   /* 원하는 고정 너비 (예: 200px) */
  height: 13.75rem ;  /* 원하는 고정 높이 (예: 200px) */
  margin: 0 auto;
  position: relative;

}
#sentimentChart {
  display: block;
  width: 100% !important;
  height: 100% !important;
  align-items: center;
  margin-top: 0.3125rem ;
  margin-left: auto;
  margin-right: 0.3125rem ;
}

/* 각 행: 왼쪽에 요일, 중앙에 기관 바, 오른쪽에 외국인 바 */
.combined-bar-row {
  display: flex; 
  align-items: center;
  margin-bottom: 0.9375rem ; /* 각 행 간격 */
}
.day-label {
  width: 2.5rem ;      /* 날짜 표시 넓이 (원하는 값으로 조정) */
  text-align: right;  
  margin-right: 0.3125rem ;
  font-weight: bold;
  font-size: 0.875rem ;
}
.bar-container {
  flex: 1;
  background-color: #eee;
  margin: 0 0.3125rem ;
  height: 1.5rem ;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}
.bar-container:hover {
  transform: scale(1.05);
}
.bar {
  height: 100%;
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding-left: 0.3125rem ;
  box-sizing: border-box;
  position: relative;
}
.bar .bar-text {
  display: none;
  font-size: 0.75rem ;
  color: #fff;
  font-weight: bold;
  white-space: nowrap;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
.bar-container:hover .bar-text {
  display: block;
}
.net-buy {
  background-color: #ff4f4f; /* 취향에 맞게 변경 */
}
.net-sell {
  background-color: #4f4fff; /* 취향에 맞게 변경 */
}
.net-neutral {
  background-color: #999;
}

/* 모바일 전용 탭 메뉴 숨기기: 기본은 데스크탑 */
#investorTabs {
  display: none;
}


/* ========== 10. 워드 클라우드 ========== */
#wordCloudBox {
  position: relative;
  max-height: 22rem ;
}

#wordCloudBox .table-wrapper {
  /* border: 1px solid #ddd;
  border-radius: 5px; */
  overflow: hidden;
  margin: 0 auto;
  background-color: var(--secondary-color);
  height: 100%;
  /* ...필요하다면 추가 스타일 */
}

/* 헤더 부분 통일감 주기 */
.wordcloud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem ;
  background-color: rgba(39, 76, 119); /* 재무 헤더와 통일감 있는 색상 */
  border-radius: 4px;
}
.wordcloud-header h3,
.wordcloud-header .unit-info {
  margin: 0;
  color: #ffffff; /* 재무박스와 색상 일치 */
}
.wordcloud-header h3 {
  font-weight: bold;
  font-size: 1rem ;
  font-family: 'GmarketSansMedium';
}

.wordcloud-header .unit-info {
  font-size: 0.875rem ;
  color: #ffffff;
}

/* 실제 워드클라우드 이미지를 담을 컨테이너 */
#wordCloudContainer {
  width: 100%;
  height: calc(100% - 45px);
  overflow: hidden;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  position: relative;
  background-color: var(--secondary-color);
  margin-top: 0.625rem;
}

#wordCloudCanvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
    
}

#wordCloudImage,
#wordCloudContainer canvas {
  transition: transform 0.3s ease, filter 0.3s ease;
}

#wordCloudContainer:hover #wordCloudImage,
#wordCloudContainer:hover canvas {
  transform: scale(1.05);
  transition: transform 0.3s ease, filter 0.3s ease;
}

/* 워드클라우드가 없을 때 노출되는 플레이스홀더 */
#wordCloudPlaceholder {
  color: #ffffff;
  font-size: 0.875rem ;
}

#wordCloudTooltip {
  position: absolute;
  pointer-events: none;
  max-width: 18rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: rgba(20, 20, 20, 0.8);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  opacity: 0;
  visibility: hidden;
  transition: opacity .20s ease, transform .20s ease;
  z-index: 5;
}

#wordCloudTooltip.visible,
.wc-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity .36s ease, transform .36s ease;
}

/* ========== 반응형 디자인 ==========
@media (max-width: 1200px) {
  #mainContainer {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
  }
  
  #myChart,
  #myVolumeChart,
  #tradingvalueChart
  #macdChart,
  #rsiChart,
  #stochChart,
  #stochrsiChart,
  #williamsChart,
  #cciChart,
  #atrChart,
  #rocChart,
  #uoChart,
  #adxChart {
    width: 100%;
    height: auto;
  }
}*/

/* fadeInUp 애니메이션 keyframes 정의 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* mainContainer의 자식 박스들에 그룹별 딜레이 적용 */
#mainContainer > .box:nth-child(1),
#mainContainer > .box:nth-child(2) { animation-delay: 0.2s; }
#mainContainer > .box:nth-child(3),
#mainContainer > .box:nth-child(4) { animation-delay: 0.4s; }
#mainContainer > .box:nth-child(5),
#mainContainer > .box:nth-child(6) { animation-delay: 0.6s; }
#bottomRow1 > .box:nth-child(1),
#bottomRow1 > .box:nth-child(2) { animation-delay: 0.8s; }
#bottomRow2 > .box:nth-child(1),
#bottomRow2 > .box:nth-child(2) { animation-delay: 1.0s; }

/* ----- 푸터 ----- */
footer {
  background-color: var(--primary-color);
  color: var(--white);
  text-align: center;
  padding: 0.9375rem  0;
  font-size: 0.875rem ;
}

/* --------------------- CSS 끝 --------------------- */

/* 햄버거 아이콘 기본 숨기기(데스크탑에서는 필요 없으므로) */
.menu-icon {
  display: none; 
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--white);
}

/* 모바일 (최대 폭 767px) */
@media (max-width: 767px) {
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    position: relative;
  }
  .header-left {
    display: flex;
    align-items: center;
  }
  .header-left, .header-right {
    margin: 0.5rem 0;
  }
  
  .menu-icon {
    display: block;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--white);
    position: absolute;
    right: 2rem;
  }
  .menu-icon:active {
    transform: scale(0.9);
    transition: transform 0.1s ease;
  }
  #main-nav {
    position: fixed;
    top: 0;
    right: 0; /* 기본 숨김 */
    width: 30%; /* 필요에 따라 조정 가능 (예: 최대 300px) */
    max-width: 300px;
    height: 100vh;
    background-color: var(--white);
    color: var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1.5rem 1rem; /* 위쪽 패딩을 늘려서 여유있게 */
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.2);
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    transform: translateX(100%);
    transition: transform var(--transition-speed) ease-out;
    will-change: transform;
    z-index: 1000;
    margin-top: 0; /* 상단 틈 제거 */
    margin-right: 0;
  }
  #main-nav.nav-active {
    transform: translateX(0);
  }
  #main-nav a.header-link {
    color: var(--primary-color);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
  }

  .box {
    /* 콘텐츠가 부족할 때 최소 높이를 보장하고, 너무 길면 최대 높이를 제한 */
    height: auto;
    max-height: 90vh;      /* 뷰포트 높이의 90%를 넘지 않도록 */
    overflow-y: auto;      /* 내부에 내용이 많으면 스크롤 처리 */

  }
  #mainContainer {
    display: flex;
    flex-direction: column;
  }
  #stockSearchBox {
    height: 3rem;
    order: 1;
  }
  #stockListBox {
    order: 2;
    display: none;
    margin-top: 0;

    overflow-y: hidden;
  }
  #stockContainer {
    max-height: 15rem;
    height: 100%;
  }
  #daysSearchBox {
    overflow-y: hidden;
    order: 3;
  }
  .chart-btn {
    min-width: 2rem;
  }
  .question:hover + p.arrow_box {
    display: none;
  }
  #emptyBox {
    order: 4;
  }
  #toggleSections2 {
    max-height: 15rem;
    height: 100%;
  }
  #chartBox {
    order: 5;
    display: none;
  }
  #myChart {
    height: 15rem; /* 모바일에 적합한 차트 높이 */
  }
  #IndexBox {
    order: 6;
    display: none;
  }
  #bottomRow1,
  #bottomRow2 {
    grid-template-columns: 1fr;
  }
  #bottomRow1 { order: 7; }
  #bottomRow2 { order: 8; }
  #tempBox1 {
    overflow-x: hidden;
  }
  #tempContainer1 {
    overflow-x: auto;
  }
  #tempBox2 {
    overflow-x: hidden;
    height: 19.1rem !important;
  }
  #undicisionedContainer {
    overflow-x: hidden;
  }
  #sentimentIndexBox {
    max-height: 100%;
    overflow-y: hidden;
  }
  #investorTabs {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    background-color: var(--secondary-color); /* 부모 배경색 지정 */
    border-radius: 4px;
    overflow: hidden;
  }
  #investorTabs button {
    flex: 1;
    padding: 10px;
    border: none;
    font-size: 14px;
    font-family: "Paperlogy";
    cursor: pointer;
    transition: background-color 0.3s;
    background-color: transparent;
  }
  #investorTabs button.active,
  #investorTabs button:focus {
    background-color: var(--primary-color);
    color: var(--white);
  }
  .investor-indicator-container {
    position: relative;  
    flex-direction: column;
    min-height: 16rem;
    height: 100%;
  }
  .gosu-header,
  .hasu-header {
    display: none;
  }
  .gosu-index-container {
    margin-top: 1rem;
  }
  .left-indicator,
  .right-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; 
  }

  #wordCloudBox{
    height: 300px;   /* 필요에 따라 60~80vh 로 조정 */
  }

  #wordCloudContainer{
    height: calc(100% - 45px); /* 위에서 수정한 문법 그대로 */
  }

  #mainContainer > .box:nth-child(1) { animation-delay: 0.2s; }
  #mainContainer > .box:nth-child(2) { animation-delay: 0.4s; }
  #mainContainer > .box:nth-child(3) { animation-delay: 0s; }
  #mainContainer > .box:nth-child(4) { animation-delay: 0s; }
  #mainContainer > .box:nth-child(5) { animation-delay: 0.6s; }
  #mainContainer > .box:nth-child(6) { animation-delay: 0s; }
  #bottomRow1 > .box:nth-child(1) { animation-delay: 0.8s; }
  #bottomRow1 > .box:nth-child(2) { animation-delay: 1.0s; }
  #bottomRow2 > .box:nth-child(1) { animation-delay: 1.2s; }
  #bottomRow2 > .box:nth-child(2) { animation-delay: 1.4s; }

  .accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: var(--white);
    cursor: pointer;
    border-radius: var(--box-radius);
    font-size: 1.25rem;
    font-weight: bold;
  }
  .accordion-toggle {
    transition: transform 0.3s ease;
  }
  /* 아코디언 내용은 기본적으로 숨김 */
  .accordion-content {
    display: none;
    padding: 0.5rem 1rem;
    background-color: var(--third-color);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--box-radius) var(--box-radius);
    max-height: 200px;
    overflow-y: auto;
  }
  /* active 클래스가 있으면 보이게 */
  .accordion-content.active {
    display: block;
  }
}

/* 태블릿 (최소 폭 768px, 최대 폭 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .accordion-header {
    display: none;
  }

  .accordion-content {
    display: block !important;
    padding: 0;      /* 데스크탑 디자인에 맞게 조정 */
    border: none;
    max-height: none;
    overflow: visible;
  }
}

/* 데스크탑 (최소 폭 1024px) */ /* 기본 스타일 그대로 적용하거나, 데스크탑 특화 스타일 추가 */
@media (min-width: 1024px) {
    /* 데스크탑에서는 아코디언 헤더 숨김 */
  .accordion-header {
    display: none;
  }
  /* 아코디언 내용은 항상 보임 (기존 레이아웃과 동일하게) */
  .accordion-content {
    display: block !important;
    padding: 0;      /* 데스크탑 디자인에 맞게 조정 */
    border: none;
    max-height: none;
    overflow: visible;
  }
}

#overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 999; /* nav보다 살짝 낮은 값 */
}

#overlay.active {
  display: block;
}

.hidden-indicator {
  opacity: 0;
  visibility: hidden;
  pointer-events: none; /* 마우스 이벤트 차단 */
}

.visible-indicator {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}