/* 차트 크게 보기 + AI Arena(미리보기). 색은 exchange.css 의 :root 토큰만 쓴다.
 * 차트 패널(.panel.chart) 안을 [차트 | Arena 열] 로 나눈다. 패널이 좁으면(760px 미만) Arena 열 대신 아래 한 줄 띠를 보인다. */

/* ── 차트 본문: 캔버스 + (켜져 있으면) Arena 열 ── */
.panel.chart { container-type: inline-size; container-name: chartp; }
.chart-body { flex: 1 1 auto; min-height: 0; display: flex; }
.chart-body > #kline { flex: 1 1 auto; min-width: 0; }

/* ── 크게 보기 ── */
.chart-max-btn {
  flex: 0 0 auto; margin-left: 6px; width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted); cursor: pointer;
}
.chart-max-btn:hover { color: var(--txt); border-color: var(--line-2); }
.chart-max-btn svg { width: 14px; height: 14px; }
.chart-ph .tb-right { right: 42px; }
.panel.chart.chart-max { position: fixed; inset: 8px; z-index: 9400; height: auto !important; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9); }
body.chart-max-open { overflow: hidden; }

/* ── Arena 열 / 띠 (기본은 숨김, .arena-on 일 때만) ── */
.ar-side, .ar-strip { display: none; }
.panel.chart.arena-on .ar-side { display: flex; }
@container chartp (max-width: 760px) {
  .panel.chart.arena-on .ar-side { display: none; }
  .panel.chart.arena-on .ar-strip { display: flex; }
  /* 크게 보기에서는 폭이 좁아도(휴대폰) Arena 열을 아래에 보인다 */
  .panel.chart.chart-max.arena-on .ar-side { display: flex; }
  .panel.chart.chart-max.arena-on .ar-strip { display: none; }
}

.ar-side { flex: 0 0 340px; width: 340px; min-height: 0; flex-direction: column; border-left: 1px solid var(--line); overflow-y: auto; }
.chart-max .ar-side { flex-basis: 380px; width: 380px; }
.ar-sec { border-bottom: 1px solid var(--line); }
.ar-sec-h { display: flex; align-items: center; gap: 8px; padding: 8px 12px 4px; font-size: 11px; color: var(--muted); }
.ar-sec-h b { color: var(--txt); font-size: 12px; font-weight: 600; }

.ar-hdr { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }
.ar-hdr .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ar-title { font-size: 14px; font-weight: 700; }
.ar-pill { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); white-space: nowrap; flex-shrink: 0; }
.ar-badge { font-size: 10.5px; padding: 2px 8px; border-radius: 6px; border: 1px dashed var(--line-2); color: var(--muted); }
.ar-duel { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--panel-3); border: 1px solid var(--line-2); font-size: 12px; }
.ar-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ar-pulse { animation: ar-pulse 1.4s ease-in-out infinite; }
@keyframes ar-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.ar-seg { display: flex; padding: 2px; border-radius: 7px; background: var(--panel-2); margin-left: auto; }
.ar-seg button { font: inherit; font-size: 10.5px; padding: 2px 8px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.ar-seg button.on { background: var(--panel-3); color: var(--txt); }

.ar-race { position: relative; height: 90px; margin: 8px 30px 12px 46px; }
.chart-max .ar-race { height: 150px; }
.ar-race svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.ar-abs { position: absolute; }
.ar-rl { left: -42px; font: 500 10px var(--mono); color: var(--muted); }

.ar-ranks { position: relative; height: 266px; margin: 2px 4px 6px; }
.ar-rank { position: absolute; left: 0; right: 0; height: 36px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent;
  color: var(--txt); font: inherit; display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer;
  transition: top .45s cubic-bezier(.2, .8, .2, 1), background .6s; }
.ar-rank:hover { background: var(--panel-2); }
.ar-rank.bump { background: var(--panel-3); }
.ar-rank .no { width: 14px; font: 700 12px var(--mono); color: var(--muted); }
.ar-rank .nm { display: flex; align-items: baseline; gap: 6px; min-width: 0; flex-grow: 1; white-space: nowrap; overflow: hidden; }
.ar-rank .nm b { font-size: 12.5px; }
.ar-rank .nm small { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.ar-rank .pct { width: 64px; text-align: right; font: 700 12px var(--mono); }

.ar-tag { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 5px; white-space: nowrap; flex-shrink: 0; }
.ar-tag.L { background: var(--up-soft); color: var(--up); }
.ar-tag.S { background: var(--down-soft); color: var(--down); }
.ar-tag.N { color: var(--muted); border: 1px solid var(--line-2); }
.ar-tag.C { background: var(--panel-3); }
.ar-tag.X { background: var(--down); color: #fff; }

.ar-feed { padding: 2px 0 8px; min-height: 180px; }
.ar-fi { padding: 7px 12px; display: flex; flex-direction: column; gap: 3px; }
.ar-fi .row { display: flex; align-items: center; gap: 7px; }
.ar-fi p { margin: 0; font-size: 12px; line-height: 1.45; }
.ar-fi.liq { background: var(--down-soft); }
.ar-fh { padding: 3px 12px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.ar-fh .r { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* 좁을 때 차트 아래 한 줄 띠 */
.ar-strip { flex: 0 0 auto; align-items: center; gap: 10px; padding: 7px 10px; border-top: 1px solid var(--line); font-size: 12px; min-width: 0; }
.ar-strip .msg { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.ar-strip button { flex: 0 0 auto; font: inherit; font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 6px; border: 1px solid var(--gold); background: var(--gold-soft); color: var(--gold); cursor: pointer; }

/* 차트(#kline) 위 이벤트 알림 */
.ar-toast { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 5; min-width: 220px; max-width: 86%;
  padding: 8px 14px; border-radius: 10px; display: flex; align-items: center; gap: 10px; pointer-events: none;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .9); animation: ar-tin .35s ease-out; }
@keyframes ar-tin { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.ar-ini { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font: 800 10px Inter, system-ui, sans-serif; color: #070a0e; flex-shrink: 0; }

/* 봇 프로필 카드 */
.ar-modal { position: fixed; inset: 0; background: rgba(3, 5, 8, .72); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 9600; }
.ar-card { width: 380px; max-width: 100%; max-height: 90vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .9); }
.ar-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ar-stats div { background: var(--panel); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.ar-stats span { font-size: 11px; color: var(--muted); }
.ar-stats b { font: 700 12px var(--mono); }
.ar-prompt { margin: 0 18px 14px; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }

@media (max-width: 760px) {
  .panel.chart.chart-max { inset: 0; border-radius: 0; }
  .chart-max .chart-body { flex-direction: column; }
  .chart-max .chart-body > #kline { flex: 0 0 52vh; }
  .chart-max .ar-side { flex: 1 1 auto; width: auto; border-left: 0; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  .ar-pulse, .ar-toast { animation: none; }
  .ar-rank { transition: none; }
}
