/* ===== 휴대폰 쾌적하게 (11/04 대표: 절반이 휴대폰) — 맨 마지막에 읽는다 ===== */
/* 손가락으로 차트를 끌다 화면 전체가 당겨지거나(새로고침) 튕기지 않게 */
html, body { overscroll-behavior: none; }
/* 누를 때 파란 네모 번쩍임 대신 우리 눌림 표시 */
* { -webkit-tap-highlight-color: transparent; }

@media (max-width: 640px) {
  /* 목록 762줄: 화면 밖 줄은 그리기 계산을 건너뛴다 (열 때 버벅임) */
  .wl-row { content-visibility: auto; contain-intrinsic-size: auto 42px; }
  .scn-res .res-row, .ms-card { content-visibility: auto; contain-intrinsic-size: auto 120px; }

  /* 즐겨찾기 막대가 비어 있으면 차트 위에 안내 문구가 떠 있던 것 → 숨김 */
  .fav-bar:has(.fb-empty) { display: none !important; }

  /* 손가락 크기: 위 줄 단추 최소 40px (애플 44pt · 구글 48dp 권장에 가깝게, 줄 높이 안에서) */
  .top-r .auth-btn, #themeBtn, .topbar .search { min-height: 40px; min-width: 40px; }
  .chart-head .hbtn, .chart-head #symBtn, .chart-head #tfMob { min-height: 40px; }
  .chart-head .hbtn:not(#symBtn):not(#tfMob) { min-width: 40px; }
  .chart-foot .hbtn.rng { min-width: 36px; height: 30px; }

  /* 눌림 표시: 손가락 아래에서 바로 반응이 보이게 */
  .mbar a { position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  .mbar a:active { color: var(--text); }
  .mbar a:active .ico { transform: scale(.9); }
  .mbar a .ico { transition: transform .12s; }
  .mbar a.on::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--brand-2); }
  .hbtn:active, .tool:active, .wl-row:active, .pop button:active { background: var(--hover, rgba(255,255,255,.06)); }
  .chart-head, .chart-foot, .mbar, .topbar { -webkit-user-select: none; user-select: none; }
  /* 11/08 zetro 고침과 같게: 차트 · 지표 이름 줄을 꾹 눌러도 글자가 선택되거나 복사 메뉴가 뜨지 않게 */
  #kc, .kc-grid { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

  /* 아래에서 올라오는 창: 끌어내리는 손잡이 쪽이 손가락에 잘 잡히게 */
  .pop.m-more-pop { touch-action: pan-y; overscroll-behavior: contain; }
  .pop.m-more-pop.dragging, .ip-sheet.dragging { transition: none !important; }
  .side .panel, .pop, .modal-b { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}
@media (prefers-reduced-motion: reduce) { .mbar a .ico { transition: none; } }

/* 휴대폰 가로: PC 화면 틀이 나와 차트가 248px 밖에 안 됐다 → 위 줄 · 아래 기간 줄을 접어 차트를 넓게 (종목 바꾸기는 차트 위 종목 단추) */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  :root:root { --topbar-h: 0px; }
  .topbar, .chart-foot, .legal-bar { display: none !important; }
  .shell { height: 100%; padding-left: max(var(--gap), env(safe-area-inset-left)); padding-right: max(var(--gap), env(safe-area-inset-right)); }
}
/* 손가락 화면 전체: 빈 즐겨찾기 막대 안내 문구가 차트를 가리지 않게 */
@media (hover: none) and (pointer: coarse) { .fav-bar:has(.fb-empty) { display: none !important; } }
/* 글자판이 올라와 있는 동안 아래 탭 숨김 (js/app.js kb-open) */
@media (max-width: 640px) { html.kb-open .mbar { display: none; } }
/* 11/06 차트를 손가락으로 위아래로 밀면 자동 맞춤이 꺼진다 → 그동안만 가격축 아래에 'A'(자동 맞춤 다시 켜기)를 크게 보인다 (가격축 두 번 누르기와 같음) */
@media (hover: none), (max-width: 640px) {
  .ax-al:has(> [data-axis="normal"]:not(.on)) { display: flex !important; opacity: 1 !important; }
  .ax-al [data-axis="log"] { display: none; }
  .ax-al [data-axis="normal"] { width: 30px; height: 30px; font-size: 13px; border-radius: 6px; }
}

/* 휴대폰 작도 십자 동그라미 (chartview bindTouchDragDraw · 트레이딩뷰 모바일처럼 '십자 옮겨 톡') */
#kc .touch-aim { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border: 3px solid #2962ff; border-radius: 50%; box-sizing: border-box; pointer-events: none; z-index: 24; will-change: transform; }
#kc .touch-aim[hidden] { display: none; }

/* 휴대폰 종목 검색: 위 여백(9vh) 때문에 창 아래 34px 이 화면 밖으로 나가던 것 → 화면 꽉 차게 (11/07) */
@media (max-width: 560px) { #searchOv { padding: 0; align-items: stretch; } #searchOv .modal.s-modal, #searchOv .modal.s-modal.s-cmp { width: 100vw; height: 100dvh; border-radius: 0; } #searchOv .s-modal .modal-h { padding-top: max(14px, env(safe-area-inset-top)); } }

/* 지표 창(아래에서 올라오는 시트): 아이폰 아래 홈 막대에 마지막 줄이 가리지 않게 */
@media (max-width: 560px) {
  #indOv .tvi-list { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
/* ===== 11/10 가상 사용자 점검 (휴대폰 · 태블릿 · UID 연결) ===== */
@media (max-width: 640px) {
  /* 가로로 돌렸다가 세로로 되돌리면 패널 접힘 표시(side-off)가 남아 현재가 칸이 끼어들고 종목 이름이 'B...'로 줄었다 → 세로 휴대폰은 현재가 칸을 늘 숨김 */
  #chartWin .chart-head #lastPx { display: none !important; }
  /* 아래 탭 글자: 11px 회색 → 크게 · 진하게 */
  .mbar.mbar a { font-size: 12.5px; color: var(--text-2); }
  .mbar.mbar a.on { color: var(--brand-2); }
  /* 위쪽 종이비행기(로그인) · 해(테마) 아이콘 아래에 작은 글자 */
  .top-r .auth-btn:not(.in), .top-r #themeBtn { flex-direction: column; justify-content: center; gap: 1px; padding-top: 2px; padding-bottom: 2px; line-height: 1; }
  .top-r .auth-btn:not(.in) .lbl { display: block !important; font-size: 10px; font-weight: 600; color: var(--text-2); }
  .top-r #themeBtn::after { content: '테마'; font-size: 10px; font-weight: 600; color: var(--text-2); }
  .top-r .auth-btn:not(.in) .ico, .top-r #themeBtn .ico { width: 18px; height: 18px; }
}
@media (max-width: 360px) { .mbar.mbar a { font-size: 11.5px; } }

/* 휴대폰 가로: 위 도구줄 단추가 높이 30px · 일부 폭 11px 로 작았다 → 손가락 크기 */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  :root:root { --hh: 44px; }
  #chartWin .chart-head { height: 44px !important; }
  #chartWin .chart-head :is(.hbtn, button) { min-height: 40px; }
  #chartWin .chart-head :is(#tfMore, #saveMenuBtn) { min-width: 28px; }
  #chartWin .chart-head #symBtn { min-width: 64px; }
  /* 왼쪽 작도 · 오른쪽 패널 단추 줄이 아래에서 잘렸다 → 밀어서 볼 수 있고, 더 있다는 걸 아래 흐림으로 */
  #drawBar, #rail { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent); mask-image: linear-gradient(#000 calc(100% - 28px), transparent); padding-bottom: 24px; }
  #drawBar::-webkit-scrollbar, #rail::-webkit-scrollbar { display: none; }
}

/* 손가락 화면(태블릿 등): 작은 단추를 키운다 · 작도 도구 옆 화살표 11px → 손가락으로 누를 수 있게 */
@media (hover: none) and (pointer: coarse) and (min-width: 641px) {
  #drawBar .tool { min-width: 40px; min-height: 40px; }
  #drawBar .dg .dg-more { width: 20px; height: 40px; right: -4px; opacity: 1; font-size: 13px; }
  #chartWin .draw-bar { width: 56px; }
  #rail button { min-height: 44px; }
  .al-acts .tool { width: 40px; height: 40px; }
}

/* 체험이 끝난 뒤 UID 확인 창 (js/unlock.js): 'UID는 어디에' 글자 단추 · 처음부터 펼친 안내 · 코바 코드 경고를 접힌 글 밖으로 */
.ul-qt { grid-column: 1 / -1; justify-self: start; min-height: 36px; padding: 0; border: 0; background: none; color: var(--brand-2); font: inherit; font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ul-tip p { margin: 0; line-height: 1.6; }
.ul-tip p + p { margin-top: 6px; }
.ul-tip p b { display: block; color: var(--text); }
.ul-tip .ul-tip-pc { color: var(--text-3); font-size: 12px; }
.ul-nocode { grid-column: 1 / -1; margin: 4px 0 0; font-size: 13px; color: var(--text); line-height: 1.55; word-break: keep-all; }
.ul-join.first { margin-top: 4px; padding-top: 0; border-top: 0; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.ul-join-s { word-break: keep-all; }
@media (hover: none) and (pointer: coarse) { .ul-qt { min-height: 44px; } }
