/* 기본 화면 */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #333;
  background: #ececec;
  font-family: Arial, sans-serif;
  text-align: center;
}

/* 상단 이미지 */
.hero-image {
  display: block;
  width: min(1300px, 100%);
  height: auto;
  margin: 0 auto;
}

/* 종목 코드 입력창 */
.symbol-field {
  position: relative;
  width: min(300px, calc(100% - 32px));
  margin: 70px auto 20px;
}

.symbol-field input {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0 8px 10px;
  color: #222;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #aaa;
  font-size: 15px;
  text-align: center;
}

.symbol-field input:focus {
  outline: 0;
}

.symbol-field label {
  position: absolute;
  bottom: 40px;
  left: 50%;
  color: #666;
  font-weight: bold;
  transform: translateX(-50%);
}

.symbol-field span {
  position: absolute;
  bottom: 0;
  left: 50%;
  z-index: 2;
  width: 0;
  height: 2px;
  background: #eb0c0c;
  transform: translateX(-50%);
  transition: width 0.2s;
}

.symbol-field input:focus ~ span {
  width: 100%;
}

/* 조회·구매·판매 버튼 */
.stock-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stock-image-button {
  width: min(100%, 200px);
  margin: 6px 2px;
  padding: 0;
  border: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  cursor: pointer;
}

.query-image {
  aspect-ratio: 2.7;
  background-image: url("조회.png");
  background-position: 50% 50%;
  background-size: 136% auto;
}

.buy-image {
  aspect-ratio: 2.7;
  background-image: url("매수.png");
  background-position: 50% 50%;
  background-size: 136% auto;
}

.sell-image {
  aspect-ratio: 2.8;
  background-image: url("매도라지.png");
  background-position: 50% 51%;
  background-size: 130% auto;
}

.stock-image-button:hover {
  transform: scale(1.02);
}

.stock-image-button:active {
  transform: scale(0.98);
}

.stock-image-button:focus-visible {
  outline: 3px solid #ff5f98;
  outline-offset: 3px;
}

/* 주가 그래프 카드 */
.chart-card {
  width: min(900px, calc(100% - 32px));
  margin: 48px auto;
  padding: 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  text-align: left;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.chart-header h2 {
  margin: 0;
}

/* 그래프 기간 버튼 */
.period-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.period-buttons button {
  padding: 7px 12px;
  color: #666;
  background: #f4f4f4;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.period-buttons button:hover,
.period-buttons button.active {
  color: #fff;
  background: #eb0c0c;
}

/* TradingView 그래프 */
#stock-chart {
  position: relative;
  width: 100%;
  height: 500px;
  margin-top: 12px;
}

#stock-chart > .tradingview-widget-container__widget {
  width: 100%;
  height: 100%;
}

/* 모바일 화면 */
@media (max-width: 600px) {
  .chart-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #stock-chart {
    height: 360px;
  }
}
