/* Ma King Insight — horse guide add-on styles (Dev). */

/* ---------- Movement: stay out of the way ---------- */
#horse-guide {
  transition: transform .35s ease, opacity .35s ease;
  will-change: transform;
}
/* Tucked into the right edge: only a sliver of the round button shows. */
#horse-guide.mkg-peek {
  transform: translateX(42px);
  opacity: .9;
}
#horse-guide.mkg-peek .horse-guide-launch { box-shadow: -2px 4px 12px rgba(16, 47, 76, .18); }
/* Slides fully off-screen while the page is scrolling. */
#horse-guide.mkg-away {
  transform: translateX(calc(100% + 28px));
  opacity: 0;
}
/* Around race start: no idle animation, no auto greeting bubble. */
#horse-guide.mkg-quiet .horse-guide-rig,
#horse-guide.mkg-quiet .horse-guide-rig * { animation: none !important; }
#horse-guide.mkg-quiet.is-auto .horse-guide-panel { display: none !important; }
/* While our bubble is talking, the built-in greeting panel steps aside. */
#horse-guide.mkg-talking .horse-guide-panel { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  #horse-guide, .mkg-bubble { transition: none !important; }
}

/* ---------- Speech bubble ---------- */
.mkg-bubble {
  position: fixed;
  right: 16px;
  bottom: 96px;
  z-index: 46;
  box-sizing: border-box;
  width: min(320px, calc(100vw - 32px));
  padding: 14px 40px 14px 16px;
  border: 1px solid #dde6ea;
  border-radius: 16px 16px 4px 16px;
  background: #ffffff;
  color: #102f4c;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 12px 32px rgba(15, 42, 68, .18);
  animation: mkg-in .25s ease-out;
}
.mkg-bubble[hidden] { display: none; }
.mkg-bubble::after {
  content: "";
  position: absolute;
  right: 26px;
  bottom: -8px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-right: 1px solid #dde6ea;
  border-bottom: 1px solid #dde6ea;
  transform: rotate(45deg);
}
.mkg-bubble-title { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 800; color: #0b7082; }
.mkg-bubble[data-kind="race"] .mkg-bubble-title,
.mkg-bubble[data-kind="odds"] .mkg-bubble-title { color: #7a4b00; }
.mkg-bubble[data-kind="race"] { border-color: #f0c94d; }
.mkg-bubble-text, .mkg-bubble-extra { margin: 0; }
.mkg-bubble-extra { margin-top: 8px; color: #33506a; font-size: 13px; }
.mkg-bubble-extra[hidden] { display: none; }
.mkg-bubble-extra a { color: #0b7082; font-weight: 800; white-space: nowrap; }
.mkg-bubble-actions { margin-top: 10px; }
.mkg-bubble-actions[hidden] { display: none; }
.mkg-bubble-ok {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #0f2a44;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.mkg-bubble-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #536a79;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.mkg-bubble-close:hover { background: #f3f6f8; }
.mkg-bubble button:focus-visible { outline: 3px solid #f6c544; outline-offset: 2px; }
@keyframes mkg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .mkg-bubble {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: calc(150px + env(safe-area-inset-bottom));
  }
}

/* ---------- Tappable terms ---------- */
[data-mkg-term] {
  cursor: help;
  text-decoration: underline dotted rgba(11, 112, 130, .55);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  border-radius: 3px;
}
[data-mkg-term]:hover { text-decoration-color: #0b7082; }
[data-mkg-term]:focus-visible { outline: 2px solid #f6c544; outline-offset: 2px; }

.mkg-pool-help {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  align-self: center;
  border: 1px solid #cdd9df;
  border-radius: 999px;
  background: #ffffff;
  color: #0b7082;
  font: inherit;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
}
.mkg-pool-help:hover { background: #e6f2f4; }
.mkg-pool-help:focus-visible { outline: 3px solid #f6c544; outline-offset: 2px; }

/* Phones: tuck further so only a small handle shows above the bottom tabs. */
@media (max-width: 760px) {
  #horse-guide.mkg-peek { transform: translateX(46px) scale(.85); transform-origin: right bottom; opacity: .85; }
}
