/* 모바일 홈 트리맵 (2026-11-10 대표님 시안 · render-mobile-home.js renderMap)
   main.css 는 버전 없이 실려 브라우저가 옛 파일을 쓸 수 있다 — 새 화면은 asset() 으로 버전이 붙는 따로 파일로 둔다 */
@media (max-width: 1023px) {
    /* 목록 끝 아래 빈 공간: .mh-wrap 아래 여백(132px, 플로팅 탭·하단 메뉴 자리)이면 충분한데
       .container 아래 여백 60 + 30, body 20 + 8 이 겹쳐 118px 이 더 비었다 (이 파일은 홈에서만 실린다) */
    body.theme-mode { padding-bottom: 0; margin-bottom: 0; }
    body.theme-mode > .container { padding-bottom: 0; margin-bottom: 0; }
    .mt-root { padding: 0 0 8px; }
    .mt-map {
        position: relative; width: 100%; border-radius: 14px; overflow: hidden;
        background: #e9ecf0; box-shadow: inset 0 1px 3px rgba(27, 35, 48, .12);
        -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; touch-action: manipulation;
    }
    .mt-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
                font-size: 13px; color: #8b95a1; }
    .mt-empty[hidden] { display: none; }
    .mt-tile {
        position: absolute; overflow: hidden; box-sizing: border-box; border-radius: 6px; cursor: pointer;
        display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
        padding: 2px 4px; line-height: 1.15;
        transition: left .35s ease, top .35s ease, width .35s ease, height .35s ease, background-color .35s ease;
    }
    /* 입체감: 위는 빛, 아래는 그늘 + 바닥 그림자 (색은 인라인 background 라 덧칠은 ::before 로) */
    .mt-tile { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), inset 0 -2px 0 rgba(0, 0, 0, .14), 0 1px 2px rgba(27, 35, 48, .22); }
    .mt-tile::before { content: ''; position: absolute; inset: 0; pointer-events: none;
        background: linear-gradient(180deg, rgba(255, 255, 255, .26) 0, rgba(255, 255, 255, .06) 42%, rgba(0, 0, 0, .1) 100%); }
    .mt-tile > * { position: relative; }
    .mt-tile .mt-n, .mt-tile .mt-p { text-shadow: 0 1px 1px rgba(0, 0, 0, .16); }
    .mt-tile:active { filter: brightness(.95); }
    .mt-tile.sel { box-shadow: inset 0 0 0 2px #fff, inset 0 -2px 0 rgba(0, 0, 0, .14), 0 4px 10px rgba(27, 35, 48, .35); z-index: 2; }
    .mt-tile b, .mt-tile i, .mt-tile span, .mt-tile em {
        display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal;
    }
    .mt-n { font-weight: 700; }
    .mt-p { font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
    .mt-v, .mt-s { opacity: .78; font-weight: 600; font-variant-numeric: tabular-nums; }
    .mt-tile.t0 > * { display: none; }
    .mt-tile.t1 .mt-n { font-size: 10.5px; } .mt-tile.t1 .mt-p { font-size: 12px; }
    .mt-tile.t1 .mt-v, .mt-tile.t1 .mt-s { display: none; }
    .mt-tile.t1:not(.tall) .mt-n { display: none; }
    .mt-tile.t2 .mt-n { font-size: 12.5px; } .mt-tile.t2 .mt-p { font-size: 17px; }
    .mt-tile.t2 .mt-v, .mt-tile.t2 .mt-s { font-size: 10px; }
    .mt-tile.t3 .mt-n { font-size: 15px; } .mt-tile.t3 .mt-p { font-size: 25px; margin-top: 1px; }
    .mt-tile.t3 .mt-v, .mt-tile.t3 .mt-s { font-size: 11px; }
    .mt-s:empty { display: none !important; }

    /* 들어간 화면 머리 */
    .mt-dhead[hidden] { display: none; }
    .mt-drow { display: flex; justify-content: space-between; align-items: center; margin: 2px 0 8px; }
    .mt-back { border: none; background: none; font: inherit; font-size: 14px; font-weight: 700; color: #4e5968; padding: 6px 2px; cursor: pointer; }
    .mt-list { border: none; border-radius: 9px; background: #1b2330; color: #fff; font: inherit; font-size: 13px; font-weight: 700;
               padding: 8px 12px; cursor: pointer; }
    .mt-dtitle { display: flex; align-items: baseline; gap: 8px; padding: 8px 2px 2px; border-top: 1px solid #e5e8eb; }
    .mt-dtitle b { font-size: 17px; font-weight: 800; color: #1b2330; }
    .mt-dp { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
    .mt-dp.up, .mt-pp.up { color: #e71909; } .mt-dp.down, .mt-pp.down { color: #115bcb; }
    .mt-dsub { font-size: 11.5px; color: #8b95a1; padding: 2px 2px 10px; }

    /* 아래 패널 */
    .mt-panel { margin-top: 12px; padding: 14px; border-radius: 14px; background: #fff; box-shadow: 0 1px 3px rgba(27, 35, 48, .08); }
    .mt-panel[hidden] { display: none; }
    .mt-panel.theme { background: linear-gradient(180deg, #fff6f5 0, #fff 90px); }
    .mt-ph { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
    .mt-ph .mh-ini { flex: none; }
    .mt-pn { font-size: 16px; font-weight: 800; color: #1b2330; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mt-pnw { flex: 1; min-width: 0; }
    .mt-pnw .mt-pn { display: block; }
    .mt-pnw i { display: block; font-style: normal; font-size: 11.5px; color: #8b95a1; }
    .mt-pr { text-align: right; }
    .mt-pp { display: block; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
    .mt-pv { display: block; font-style: normal; font-size: 11px; color: #8b95a1; }
    .mt-rows .mh-srow[hidden] { display: none; }
    /* 패널 목록은 글씨를 키우고 줄 간격을 넓힌다 (아래가 휑하지 않게 · 2026-11-10 대표님) — 아코디언 목록은 그대로 */
    .mt-panel .mt-pn { font-size: 18px; }
    .mt-panel .mt-pp { font-size: 18px; }
    .mt-panel .mt-pv { font-size: 12px; margin-top: 1px; }
    .mt-panel .mh-chips { margin: 4px 0 6px; }
    .mt-panel .mh-chips button { font-size: 12.5px; padding: 6px 11px; white-space: nowrap; flex: none; }
    .mt-panel .mh-updown { font-size: 12px; white-space: nowrap; }
    .mt-rows .mh-srow { gap: 8px; padding: 15px 4px; }
    .mt-rows .mh-sno { width: 16px; font-size: 13px; text-align: center; }
    .mt-rows .mh-sini { width: 28px; height: 28px; font-size: 12px; }
    .mt-rows .mh-sname { line-height: 1.35; }
    .mt-rows .mh-sname b { font-size: 15.5px; }
    .mt-rows .mh-sname i { font-size: 12px; margin-top: 1px; }
    .mt-rows .mh-snums { line-height: 1.35; }
    .mt-rows .mh-spct { font-size: 16.5px; }
    .mt-rows .mh-spa { font-size: 11.5px; margin-top: 1px; }
    .mt-panel .mh-more { margin-top: 10px; padding: 13px 0; font-size: 14px; }
    /* 종목 기준: 고른 종목 한 줄 + 아래 그 종목 테마 목록 */
    .mt-sone { cursor: pointer; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #eef0f3; }
    .mt-tpart[hidden] { display: none; }
    .mt-tpart { margin: 0 -14px -14px; padding: 12px 14px 14px; border-radius: 0 0 14px 14px;
                background: linear-gradient(180deg, #fff6f5 0, #fff 90px); }

    /* 길게 누름 시트 */
    .mt-sheet { position: fixed; inset: 0; z-index: 1200; pointer-events: none; }
    .mt-sheet .mt-dim { position: absolute; inset: 0; background: rgba(27, 35, 48, .45); opacity: 0; transition: opacity .2s; }
    .mt-sheet .mt-sbody { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 18px 18px 0 0;
                          padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .22s ease; }
    .mt-sheet.on { pointer-events: auto; }
    .mt-sheet.on .mt-dim { opacity: 1; }
    .mt-sheet.on .mt-sbody { transform: none; }
    .mt-grab { display: block; width: 38px; height: 4px; border-radius: 2px; background: #d6dae0; margin: 0 auto 12px; }
    .mt-sh { display: flex; align-items: center; gap: 10px; }
    .mt-sh b { font-size: 17px; font-weight: 800; color: #1b2330; }
    .mt-sbig { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; }
    .mt-sbig > span { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
    .mt-sbig .up { color: #e71909; } .mt-sbig .down { color: #115bcb; }
    .mt-sbig em { font-style: normal; font-size: 13px; color: #4e5968; }
    .mt-srank { font-size: 12px; color: #8b95a1; margin: 2px 0 10px; padding-bottom: 10px; border-bottom: 1px solid #e5e8eb; }
    .mt-stitle { font-size: 12px; color: #6b7684; margin-bottom: 4px; }
    .mt-srow { display: grid; grid-template-columns: 18px 1fr auto 52px; gap: 8px; align-items: center; padding: 8px 0; font-size: 14px; cursor: pointer; }
    .mt-srow > span { color: #8b95a1; font-size: 12px; }
    .mt-srow b { font-weight: 600; color: #1b2330; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mt-srow em { font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }
    .mt-srow em.up { color: #e71909; } .mt-srow em.down { color: #115bcb; }
    .mt-srow i { font-style: normal; font-size: 12px; color: #8b95a1; text-align: right; }
    .mt-sbtns { display: flex; gap: 8px; margin-top: 12px; }
    .mt-sbtns button { flex: 1; height: 48px; border-radius: 12px; border: 1px solid #d6dae0; background: #fff; font: inherit;
                       font-size: 14.5px; font-weight: 700; color: #1b2330; cursor: pointer; }
    .mt-sbtns button.dark { background: #1b2330; border-color: #1b2330; color: #fff; }
}

/* 좁은 폰(≤360px)은 패널 목록 글씨를 한 단계 줄인다 — 이름이 잘리지 않게 */
@media (max-width: 360px) {
    .mt-rows .mh-srow { gap: 6px; padding: 13px 2px; }
    .mt-rows .mh-sno { width: 12px; font-size: 12px; }
    .mt-rows .mh-sini { width: 24px; height: 24px; font-size: 11px; }
    .mt-rows .mh-sname b { font-size: 14px; }
    .mt-rows .mh-sname i { font-size: 11px; }
    .mt-rows .mh-spct { font-size: 14.5px; }
    .mt-rows .mh-spa { font-size: 10.5px; }
    .mt-panel .mh-chips button { font-size: 11.5px; padding: 5px 9px; }
    .mt-panel .mh-updown { font-size: 11px; white-space: normal; text-align: right; }
}
