/* v3.1 手機版：只在 html.m（≤768px，或觸控橫向手機）生效；桌機完全不受影響 */
@media (max-width:768px), (pointer:coarse) and (max-height:500px){
html.m,html.m body{height:100%;overflow:hidden;overscroll-behavior:none;-webkit-text-size-adjust:100%}
html.m body{padding:env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);box-sizing:border-box;width:100%;max-width:100vw;overflow-x:hidden;touch-action:manipulation}
html.m #menu{height:auto;min-height:52px;padding:4px 8px;gap:6px;flex-wrap:nowrap;overflow:hidden}
html.m #menu>*:not(.logo):not(.qwrap){display:none!important}
html.m #menu .logo{font-size:13px;white-space:nowrap}
html.m #menu .qwrap{flex:1;min-width:0;position:relative}
html.m #q,html.m input,html.m select,html.m textarea{font-size:16px!important;min-height:44px;box-sizing:border-box}
html.m #q{width:100%!important}
html.m #sugg{position:fixed;left:8px;right:8px;width:auto!important;max-height:60vh;overflow:auto;z-index:60}
html.m #sugg>*{min-height:44px;display:flex;align-items:center}
html.m #qbar,html.m #sub,html.m #status{display:none!important}
html.m #mhead{display:flex;align-items:baseline;justify-content:space-between;gap:8px;padding:2px 12px 6px;background:var(--panel);border-bottom:1px solid #222}
html.m #mhead .mq{display:flex;align-items:baseline;gap:8px;min-width:0;white-space:nowrap;overflow:hidden}
html.m #mhead .msym{font-size:17px}
html.m #mhead .mname{font-size:14px;color:#aaa;overflow:hidden;text-overflow:ellipsis}
html.m #mhead .mpx{font-size:22px;font-weight:bold}
html.m #mhead .mchg{font-size:14px}
html.m #mhead .masof{font-size:12px;white-space:nowrap}
html.m #ws{padding:0;padding-bottom:calc(58px + env(safe-area-inset-bottom));overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch}
html.m #ws .gv,html.m #ws .gh{display:none}
html.m #ws .row{min-height:0}
html.m .cell{border-radius:0;border-left:0;border-right:0;min-width:0}
html.m .ph button,html.m .ph .fullhint{display:none}
html.m .ph{min-height:36px;font-size:15px}
html.m[data-mt=chart] .ph{display:none}
/* 多列分頁（籌碼、資金流向）改成可上下捲動，每列固定高度 */
html.m[data-mt=chips] #ws .row,html.m[data-mt=flow] #ws .row{flex:none!important;height:62vh}
html.m[data-mt=chips] #ws .row:first-child{height:56vh}
html.m[data-mt=more2] #ws .row{flex:none!important;height:64vh}html.m[data-mt=more2] #ws .row:only-child{height:100%}
html.m .optp select{max-width:100%}html.m .optp .ocon{flex:1;min-width:0}html.m .optp .olg{width:100%;font-size:12px}html.m .optp .osum{font-size:14px;gap:8px 12px}html.m .optp .onote{white-space:normal}
html.m button,html.m .tb button,html.m .tb .period{min-height:44px;min-width:44px;font-size:15px}
/* 工具列：只留週期，橫向滑動 */
html.m .tb{flex-wrap:nowrap!important;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;gap:4px;padding:4px 8px;-webkit-overflow-scrolling:touch}
html.m .tb::-webkit-scrollbar,html.m .itabs::-webkit-scrollbar{display:none}
html.m .tb>*{flex:none}
html.m .tb label,html.m .tb [data-tool],html.m .tb .calcb,html.m .tb .adjb,html.m .tb .sep,html.m .tb .mut{display:none!important}
html.m .tb .iksel{min-width:76px}
html.m .tb .star{font-size:20px}
html.m .mtoolb{background:#1a1a1a;border:1px solid #333;border-radius:6px;padding:0 10px}
html.m .itabs{flex-wrap:nowrap!important;overflow-x:auto;scrollbar-width:none;gap:4px;padding:4px 8px}
html.m .itabs>*{flex:none;min-height:44px;min-width:52px;display:flex;align-items:center;justify-content:center;font-size:15px;padding:0 10px;box-sizing:border-box}
html.m .trow>.calc{display:none!important}
html.m.mcalcon .trow>.calc.on{display:block!important;position:fixed;left:0;right:0;bottom:0;width:auto!important;max-height:72vh;overflow-y:auto;z-index:80;background:#111;border-top:1px solid #333;border-radius:14px 14px 0 0;padding:10px 14px calc(14px + env(safe-area-inset-bottom));box-sizing:border-box}
html.m.mcalcon .trow>.calc.on .cx{min-width:44px;min-height:44px}
html.m.mcalcon .trow>.calc.on input,html.m.mcalcon .trow>.calc.on select{width:100%}
html.m .c0,html.m .c1,html.m .c2{touch-action:none}
html.m .toolhint{font-size:13px}
html.m .tolatest{min-height:44px;min-width:44px}
/* 自選清單 */
html.m .wl .wi{min-height:56px;align-items:center}
html.m .wl .wi .x{min-width:44px;min-height:44px;display:flex;align-items:center;justify-content:center;opacity:1}
html.m .grp,html.m .gadd{min-height:44px;min-width:44px;justify-content:center;display:inline-flex;align-items:center;padding:0 12px;box-sizing:border-box}
/* 底部分頁列 */
html.m #mtab{position:fixed;left:0;right:0;bottom:0;z-index:50;display:flex;background:#0b0b0b;border-top:1px solid #262626;padding:0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
html.m #mtab a{flex:1;min-height:56px;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#888;font-size:12px;text-decoration:none;gap:2px;-webkit-tap-highlight-color:transparent}
html.m #mtab a i{font-style:normal;font-size:20px;line-height:1}
html.m #mtab a.on{color:#fff}html.m #mtab a.on i{filter:none}
html.m #mtab a.on span{border-bottom:2px solid var(--up,#f33)}
/* 底部抽屜 */
html.m #mdrawer{position:fixed;inset:0;z-index:70;pointer-events:none}
html.m #mdrawer .mback{position:absolute;inset:0;background:#000a;opacity:0;transition:opacity .2s}
html.m #mdrawer .msheet{position:absolute;left:0;right:0;bottom:0;max-height:78vh;overflow-y:auto;background:#111;border-top:1px solid #333;border-radius:14px 14px 0 0;transform:translateY(100%);transition:transform .22s;padding:0 14px calc(14px + env(safe-area-inset-bottom));box-sizing:border-box}
html.m #mdrawer.on{pointer-events:auto}html.m #mdrawer.on .mback{opacity:1}html.m #mdrawer.on .msheet{transform:none}
html.m .mgrip{width:40px;height:5px;border-radius:3px;background:#444;margin:8px auto 4px}
html.m .msheet h3{font-size:15px;margin:12px 0 8px;color:#aaa}
html.m .mchips{display:flex;flex-wrap:wrap;gap:8px}
html.m .mchips button{border-radius:22px;padding:0 14px;background:#1a1a1a;border:1px solid #333}
html.m .mchips button.on{border-color:var(--up,#f33);color:#fff;background:#2a0d0d}
html.m .mgrid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
html.m .mgrid button{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;min-height:60px;padding:8px 12px;text-align:left;background:#1a1a1a;border:1px solid #333;border-radius:10px}
html.m .mgrid button small{color:#888;font-size:12px;font-weight:normal}
html.m .mrow{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;font-size:15px}
html.m .mcalc .calc{display:block!important;position:static!important;width:auto!important;max-width:none;border:0;padding:0}
html.m .mcalc .calc .cx{display:none}
html.m .mcalc .calc input,html.m .mcalc .calc select{width:100%}
html.m #toast{left:12px;right:12px;top:calc(env(safe-area-inset-top) + 8px);max-width:none}
html.m #toast button{min-height:44px}
html.m .pop{max-width:calc(100vw - 16px)}
}
html:not(.m) #mhead,html:not(.m) #mtab,html:not(.m) #mdrawer{display:none!important}
/* 橫向：隱藏頂部報價列以外的裝飾，圖表全寬 */
@media (pointer:coarse) and (max-height:500px), (max-width:932px) and (max-height:500px) and (orientation:landscape){
html.m #menu{min-height:44px;padding:2px 8px}
html.m #menu .logo{display:none}
html.m #mhead{position:absolute;top:calc(env(safe-area-inset-top) + 4px);right:calc(env(safe-area-inset-right) + 8px);left:auto;border:0;background:transparent;padding:0;pointer-events:none;z-index:5}
html.m #mhead .masof{display:none}
html.m #menu .qwrap{max-width:38%;flex:none;width:38%}
html.m #mtab a{min-height:44px;flex-direction:row;gap:6px}
html.m #ws{padding-bottom:calc(46px + env(safe-area-inset-bottom))}
html.m #ws .row{width:100%}
html.m .tcol .info .i1{display:none}
}
html.m .optp .onote{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
html.m .peakhd{font-size:11px;max-width:60%;top:2px;padding:2px 4px}html.m .peakhd select{font-size:16px;min-height:36px;max-width:150px}html.m .tb .peakl{display:none!important}
