/* =========================
   2등주 공유 모달 (정리본)
   ========================= */

/* 오버레이 */
.second-share-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55);
  z-index: 3000;
}
.second-share-overlay.hidden { display: none; }

/* 모달 프레임 */
.second-share-modal {
  width: min(560px, 92vw);              /* PC 폭 과하지 않게 */
  max-height: 90vh;                     /* 화면 내로 */
  background: #0e1116;
  color: #e7ebf0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  overflow: hidden;                     /* 바깥은 감춤 */
}

/* 닫기 버튼 */
.second-share-close {
  position: absolute; top: 10px; right: 12px;
  font-size: 26px; line-height: 1;
  background: transparent; color: #98a2b3;
  border: 0; cursor: pointer;
}
.second-share-close:hover { color: #fff; }

/* 헤더 */
.second-share-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0));
}
.second-share-header-left { display: inline-flex; align-items: center; gap: 8px; }
.second-share-logo { height: 24px; object-fit: contain; filter: drop-shadow(0 1px 0 rgba(0,0,0,0.3)); }

/* 타이틀(보통 오늘 날짜) */
.second-share-title {
  font-size: 18px; font-weight: 700; letter-spacing: .2px;
  margin: 12px 16px 8px;
}

/* 바디(안에서만 스크롤) */
.second-share-body {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 10px;
}

/* ----- 카드 스택 (정보/QR 동일 폭) ----- */
.second-share-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 공통 카드 */
.second-share-card {
  background: #121724;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 14px;
}
.second-share-card.info { order: 1; }
.second-share-card.qr   { order: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* 정보 카드 라인 */
.info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 2px;
}
.info-label { color: #9aa4b2; font-size: 13px; }
.info-value {
  font-size: 15px; font-weight: 600; color: #e9edf3; margin-left: 8px;
  max-width: 70%; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.divider { height: 1px; background: rgba(255,255,255,0.07); margin: 10px 0 6px; }

.info-time-chip {
  font-variant-numeric: tabular-nums;
  font-size: 13px; font-weight: 700;
  padding: 6px 10px; border-radius: 999px;
  color: #e7ebf0; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
}

/* 등락 칩(상승=빨강, 하락=파랑) */
.info-chip {
  font-variant-numeric: tabular-nums;
  font-size: 16px; font-weight: 800;
  padding: 8px 12px; border-radius: 999px;
  border: none; color: #fff; background: #4a4a4a;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
}
.info-chip.pos { background: #e71909; box-shadow: 0 6px 18px rgba(231,25,9,.35); }
.info-chip.neg { background: #3486d1; box-shadow: 0 6px 18px rgba(52,134,209,.35); }
.info-chip.neu { background: #666; }

/* QR 카드 (카드와 같은 폭, 내부에서만 크기 제한) */
.second-share-card.qr .qr-wrap {
  width: 100%;
  display: grid;
  place-items: center;
}
#second-share-qr {
  width: min(192px, 100%);        /* PC 기준 */
  aspect-ratio: 1 / 1;
}
#second-share-qr svg, #second-share-qr canvas {
  width: 100%; height: 100%; display: block;
}
.qr-caption { margin-top: 6px; color: #9aa4b2; font-size: 11px; }

/* 푸터 */
.second-share-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.second-share-btn {
  padding: 10px 14px; font-size: 14px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: #1a2233; color: #e7ebf0; cursor: pointer;
  transition: filter .15s ease;
}
.second-share-btn:hover { filter: brightness(1.1); }
.second-share-btn.outline { background: transparent; }

/* ===== 렌더 리스트의 2등주 카드 하단 공유줄(인라인) ===== */
.follower-card .line.line-share {
  display: flex;
  justify-content: flex-end;   /* 오른쪽 끝 */
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  border-top: none;            /* 점선 제거 */
  padding-top: 0;
}
.follower-card .line.line-share .share-inline {
  width: 30px; height: 30px; aspect-ratio: 1/1;
  display: inline-grid; place-items: center;
  background: #ffffff; color: #0f172a;
  border: 1px solid #d0d7de; border-radius: 999px;
  box-shadow: 0 6px 18px rgba(2,6,23,0.18);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, background .12s ease;
}
.follower-card .line.line-share .share-inline:hover { background:#f3f4f6; transform:translateY(-1px); box-shadow:0 8px 20px rgba(2,6,23,0.2); }
.follower-card .line.line-share .share-inline:active { background:#e9ecef; transform:translateY(0); }
.follower-card .line.line-share .share-inline svg { width:18px; height:18px; }

/* 모바일 최적화 */
@media (max-width: 520px) {
  .second-share-overlay {
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    box-sizing: border-box;
  }
  .second-share-modal {
    width: 92vw;
    max-height: calc(100svh - 24px);   /* 주소창 변동에 안전 */
    border-radius: 14px;
  }
  .second-share-header { padding: 10px 12px; }
  .second-share-title  { font-size: 16px; margin: 10px 12px 8px; }
  .second-share-body   { padding: 10px 12px 8px; }

  .second-share-card { border-radius: 12px; padding: 12px; }
  .info-row { padding: 6px 2px; }
  .info-label { font-size: 12px; }
  .info-value { font-size: 14px; }
  .info-chip, .info-time-chip { font-size: 12px; padding: 5px 9px; }

  /* QR 더 작게 */
  #second-share-qr { width: min(192px, 100%); }
  .qr-caption { font-size: 10px; margin-top: 4px; }

  .second-share-footer { padding: 10px 12px 12px; gap: 8px; }
}

/* 캡쳐 시(저장용) 보정 - 선택 */
.second-share-modal.__capture { box-shadow: none !important; border-color: rgba(255,255,255,0.10) !important; }
.second-share-modal.__capture * { scrollbar-width: none; }
.second-share-modal.__capture *::-webkit-scrollbar { display: none; }

/* 설정(모바일 기어) 여백 */
#open-settings-btn, .mobile-settings-btn { margin: 8px 0 8px 8px; }

/* 모달 프레임 (폭만 축소) */
.second-share-modal {
  width: min(420px, 92vw);     /* 🔽 데스크톱 최대폭 420px로 줄임 */
  max-height: 90vh;
  background: #0e1116;
  color: #e7ebf0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* 더 좁게 쓰고 싶으면 (선택) */
@media (min-width: 1200px) {
  .second-share-modal { width: 380px; } /* 취향껏 360~400px 사이 추천 */
}

/* 모달 프레임 (하나로 통합) */
.second-share-modal {
  position: relative;                    /* ← 요 한 줄이 핵심 */
  width: min(420px, 92vw);
  max-height: 90vh;
  background: #0e1116;
  color: #e7ebf0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  overflow: hidden;
}
@media (min-width: 1200px) {
  .second-share-modal { width: 380px; }
}

/* 캡쳐 모드에서는 X 버튼과 하단 버튼 숨김 */
.second-share-modal.__capture .second-share-close,
.second-share-modal.__capture .second-share-footer {
  display: none !important;
}
