/* 高度バーグラフ(画面下・altchart.js)。表示中は body.altchart-on で地図と右下・左下の表示を上へずらす */
:root { --acx-h: clamp(150px, 25vh, 280px); --acx-lbl: 30px; --acx-top: 26px; }
body.altchart-on #map { bottom: var(--acx-h); }
body.altchart-on #status,
body.altchart-on #legends { bottom: calc(var(--acx-h) + 8px); }
body.altchart-on #toast { bottom: calc(var(--acx-h) + 64px); }
body.altchart-on #panels { max-height: calc(100vh - var(--acx-h) - 20px); }
body.altchart-on #settingsPanel { max-height: calc(100vh - var(--acx-h) - 70px); overflow-y: auto; }   /* 設定を変えながらグラフが見えるように */
@media (max-width: 640px) { body.altchart-on #legends { bottom: calc(var(--acx-h) + 46px); } }

#altChart {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--acx-h); z-index: 1000;
  background: #111827; color: #e5e7eb; border-top: 1px solid #374151;
  display: flex; flex-direction: column; font-size: 11px; box-sizing: border-box;
  padding: 4px 8px 4px 0; user-select: none;
}
#altChart[hidden] { display: none; }
.acx-head { display: flex; align-items: center; gap: 10px; padding-left: 8px; height: 20px; flex: 0 0 auto; white-space: nowrap; overflow: hidden; }
.acx-head .acx-title { font-weight: 700; font-size: 12px; }
.acx-head .acx-ref { color: #9ca3af; overflow: hidden; text-overflow: ellipsis; }
.acx-legend { margin-left: auto; display: flex; gap: 8px; }
.acx-legend span { display: inline-flex; align-items: center; gap: 3px; color: #d1d5db; }
.acx-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.acx-legend .acx-red { font-weight: 400; }

.acx-body { flex: 1; display: flex; min-height: 0; }
.acx-y { position: relative; width: 46px; flex: 0 0 auto; margin: var(--acx-top) 0 var(--acx-lbl); }
.acx-yl { position: absolute; right: 6px; transform: translateY(50%); color: #9ca3af; font-size: 10px; }
.acx-yu { position: absolute; right: 6px; top: calc(-1 * var(--acx-top) + 2px); color: #6b7280; font-size: 10px; }
.acx-plot { position: relative; flex: 1; min-width: 0; }
.acx-grid { position: absolute; left: 0; right: 0; top: var(--acx-top); bottom: var(--acx-lbl); pointer-events: none; }
.acx-gl { position: absolute; left: 0; right: 0; border-top: 1px dashed #374151; }
.acx-gl:first-child { border-top: 1px solid #6b7280; }
.acx-cols { position: absolute; inset: 0; display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.acx-col { flex: 1 1 0; min-width: 54px; max-width: 110px; display: flex; flex-direction: column; cursor: pointer; border-radius: 4px; }
.acx-col:hover { background: rgba(255,255,255,.05); }
.acx-col.sel { background: rgba(59,130,246,.18); outline: 1px solid #3b82f6; }
.acx-track { position: relative; flex: 1; margin: var(--acx-top) 18% 0; }
.acx-bar { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 3px 3px 0 0; transition: height .6s ease, background-color .3s; min-height: 2px; }
.acx-bar.up  { background: #22c55e; }
.acx-bar.dn  { background: #facc15; }
.acx-bar.red { background: #ef4444; }
.acx-bar.nt  { background: #94a3b8; }
.acx-val { position: absolute; left: -24%; right: -24%; text-align: center; line-height: 1.15; padding-bottom: 2px; font-variant-numeric: tabular-nums; transition: bottom .6s ease; white-space: nowrap; }
.acx-cl { font-size: 10px; }
.acx-cl.up { color: #4ade80; } .acx-cl.dn { color: #fde047; } .acx-cl.red { color: #fca5a5; } .acx-cl.nt { color: #9ca3af; }
.acx-lbl { height: var(--acx-lbl); flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; overflow: hidden; }
.acx-lbl b { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acx-lbl span { color: #9ca3af; font-size: 10px; white-space: nowrap; }
.acx-empty { margin: auto; color: #9ca3af; font-size: 12px; }
body.kiosk #altChart .acx-cols { overflow-x: hidden; }
@media (max-width: 640px) { .acx-legend { display: none; } .acx-col { min-width: 64px; } .acx-lbl span { font-size: 9.5px; } }

/* グラフで選んだ機体を囲む輪(上昇中の赤丸 46px より大きい二重の輪) */
.acx-ring { pointer-events: none; }
.acx-ring i { position: absolute; inset: 0; box-sizing: border-box; border-radius: 50%; }
.acx-ring i:first-child { border: 4px solid #e53935; box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 10px rgba(229,57,53,.9); }
.acx-ring i:last-child { border: 3px solid #e53935; animation: acx-ring-ping 1.6s ease-out infinite; }
@keyframes acx-ring-ping { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .acx-ring i:last-child { animation: none; opacity: 0; } }

/* 設定パネル */
#settingsPanel #acxSub[hidden] { display: none; }
#settingsPanel .acx-tools { display: flex; gap: 6px; margin-top: 6px; }
#settingsPanel .acx-tools button { flex: 1; font-size: 12px; padding: 4px; border-radius: 6px; border: 1px solid #bbb; background: #f8fafc; cursor: pointer; }
#settingsPanel #acxList { max-height: 160px; overflow-y: auto; margin-top: 4px; border: 1px solid #eceff3; border-radius: 6px; padding: 0 6px 4px; }
#settingsPanel label.acx-li { margin-top: 4px; font-size: 12.5px; }
#settingsPanel .acx-li-n { font-weight: 600; }
#settingsPanel .acx-li-d { margin-left: auto; color: #888; font-size: 11px; }
#settingsPanel input#acxRed { width: 60px; margin: 0 6px; padding: 3px 5px; border: 1px solid #bbb; border-radius: 6px; font-size: 13px; }
