/* Trade coach (js/coach.js): review card over the chart, breathing pause and «стоп-день» in the demo ticket. */

/* ---------- review card: bottom-right of the chart, clear of the price and time axes ---------- */
.cg-card {
  position: absolute; right: 76px; bottom: 40px; z-index: 30; width: min(360px, calc(100% - 92px));
  display: grid; gap: 6px; padding: 12px 14px 12px;
  background: var(--glass-bg, var(--surface3)); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid var(--glass-edge, var(--border-strong)); border-radius: var(--r-lg); box-shadow: var(--glass-shadow, none);
  font-size: var(--fs-sm); color: var(--text);
  animation: cg-in var(--dur-slow) var(--ease) both;
}
@keyframes cg-in { from { opacity: 0; transform: translateY(10px); } }
.cg-head { display: flex; align-items: center; gap: 8px; min-width: 0; padding-bottom: 6px; border-bottom: 1px solid var(--glass-sep, var(--border)); }
.cg-title { font-weight: 600; }
.cg-sym { font: 500 var(--fs-xs) var(--mono); color: var(--muted); }
.cg-side { font-size: var(--fs-xs); }
.cg-side.up, .cg-pnl.up { color: var(--long); }
.cg-side.down, .cg-pnl.down { color: var(--short); }
.cg-pnl { margin-left: auto; font: 600 var(--fs-sm) var(--mono); }
.cg-x { display: grid; place-items: center; width: 24px; height: 24px; margin-right: -4px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--muted); cursor: pointer; }
.cg-x:hover { background: var(--glass-hover); color: var(--text); }
.cg-x:focus-visible, .cg-show:focus-visible { outline: 2px solid #9A9A9A; outline-offset: 1px; }
.cg-x .icon { width: 14px; height: 14px; }

/* three lines: the label column carries the colour, the text stays plain */
.cg-line { display: grid; grid-template-columns: 72px 1fr; gap: 8px; margin: 0; line-height: 1.45; }
.cg-line b { font-weight: 600; font-size: var(--fs-xs); padding-top: 1px; }
.cg-good b { color: var(--long); }
.cg-bad b { color: var(--warning); }
.cg-task b { color: var(--text); }
.cg-txt { color: var(--text); text-wrap: pretty; }
.cg-done { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-xs); color: var(--long); }
.cg-done .icon { width: 14px; height: 14px; }
.cg-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 6px; flex-wrap: wrap; }
.cg-show, .cg-lesson { display: inline-flex; align-items: center; gap: 6px; }
.cg-show .icon, .cg-lesson .icon { width: 14px; height: 14px; }
.cg-note { flex-basis: 100%; color: var(--muted); font-size: var(--fs-2xs); }
.cg-msg { margin: 0; font-size: var(--fs-xs); color: var(--muted); }
.cg-msg[hidden] { display: none; }

@media (max-width: 767px) {
  .cg-card { left: 8px; right: 8px; bottom: 36px; width: auto; }
}

/* ---------- ticket slot: the coach card replaces the order form while it is up ---------- */
#ticketPanel.cg-hold #tradeForm, #ticketPanel.cg-hold #confirmCard { display: none !important; }
.cg-slot[hidden] { display: none; }
.cg-hold-card { display: grid; gap: var(--s2); margin: var(--s3); padding: var(--s3); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); background: var(--panel2); font-size: var(--fs-xs); }
.cg-hold-card p { margin: 0; line-height: 1.5; color: var(--text); }
.cg-hold-card p.muted { color: var(--muted); }
.cg-hold-head { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); }
.cg-hold-head .icon { width: 16px; height: 16px; color: var(--muted); }
.cg-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.cg-actions-col { flex-direction: column; align-items: stretch; margin-top: var(--s1); }
.cg-actions .btn { justify-content: center; gap: 6px; }
.cg-actions .icon { width: 14px; height: 14px; }
.cg-hold-card > .btn { justify-self: start; }

/* breathing: the ring grows for the inhale (4 s) and shrinks for the exhale (6 s) */
.cg-breath { display: grid; place-items: center; height: 148px; }
.cg-breath > * { grid-area: 1 / 1; }
.cg-orb {
  --in: 4s; --out: 6s; --cycle: 10s;
  display: grid; place-items: center; width: 128px; height: 128px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--text) 38%, transparent);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--text) 14%, transparent), transparent);
  animation: cg-breathe var(--cycle) cubic-bezier(.45, 0, .55, 1) infinite;
}
.cg-phase { font-size: var(--fs-md); font-weight: 500; letter-spacing: .02em; color: var(--text); }
@keyframes cg-breathe {
  0% { transform: scale(.62); }
  40% { transform: scale(1); }   /* 4 of 10 s */
  100% { transform: scale(.62); }
}

@media (prefers-reduced-motion: reduce) {
  .cg-card { animation: none; }
  .cg-orb { animation: none; transform: none; }
}
.cg-hold-card .rl-count b.cg-plain { font: 500 var(--fs-xs) var(--sans); }
