/* Coach floating widget — draggable / resizable / adaptive */
:root {
  --coach-bg: #0d1118;
  --coach-panel: #141a24;
  --coach-line: rgba(255,255,255,0.08);
  --coach-text: #edf2f7;
  --coach-dim: #8b95a8;
  --coach-enter: #3dd68c;
  --coach-exit: #ff6b6b;
  --coach-wait: #9aa3b5;
  --coach-accent: #6b9fff;
  --coach-shadow: 0 18px 50px rgba(0,0,0,0.55);
}

#coach-fab {
  position: fixed;
  z-index: 95;
  right: 16px;
  bottom: 16px;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 650;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #061018;
  background: linear-gradient(135deg, #7eb6ff, #5b8def);
  cursor: pointer;
  box-shadow: var(--coach-shadow);
}
#coach-fab[hidden] { display: none !important; }

#coach-window {
  position: fixed;
  z-index: 100;
  left: 12px;
  top: 72px;
  width: min(380px, calc(100vw - 24px));
  height: min(520px, calc(100vh - 96px));
  min-width: 260px;
  min-height: 280px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  display: none;
  flex-direction: column;
  background: var(--coach-bg);
  border: 1px solid var(--coach-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--coach-shadow);
  color: var(--coach-text);
  font-family: "IBM Plex Sans", Inter, system-ui, sans-serif;
}
#coach-window.open { display: flex; }

.coach-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--coach-panel);
  border-bottom: 1px solid var(--coach-line);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.coach-titlebar:active { cursor: grabbing; }
.coach-titlebar .coach-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--coach-wait);
  flex-shrink: 0;
}
.coach-titlebar .coach-dot.ok { background: var(--coach-enter); }
.coach-titlebar .coach-dot.bad { background: var(--coach-exit); }
.coach-titlebar strong {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--coach-dim);
}
.coach-titlebar .coach-status {
  margin-left: auto;
  font-size: 11px;
  color: var(--coach-dim);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45%;
}
.coach-win-btns { display: flex; gap: 4px; flex-shrink: 0; }
.coach-win-btns button {
  border: 0;
  background: transparent;
  color: var(--coach-dim);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.coach-win-btns button:hover { background: rgba(255,255,255,0.06); color: var(--coach-text); }

.coach-body {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.coach-hero {
  flex: 1;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 2px 4px;
}
.coach-badge {
  display: inline-flex;
  align-self: flex-start;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  padding: 5px 9px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.coach-badge.ENTER { background: rgba(61,214,140,0.14); color: var(--coach-enter); }
.coach-badge.EXIT { background: rgba(255,107,107,0.14); color: var(--coach-exit); }
.coach-badge.WAIT { background: rgba(154,163,181,0.12); color: var(--coach-wait); }

.coach-sym {
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 700;
  line-height: 1.15;
  word-break: break-word;
}
.coach-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--coach-dim);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}
.coach-reason {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(237,242,247,0.92);
}
.coach-size {
  margin-top: 14px;
  font-size: clamp(16px, 3.5vw, 20px);
  font-weight: 650;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--coach-enter);
}
.coach-size.exit { color: var(--coach-exit); }

.coach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.coach-actions button {
  border: 1px solid var(--coach-line);
  background: #1a2230;
  color: var(--coach-text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.coach-actions button.primary {
  background: var(--coach-enter);
  color: #062214;
  border-color: transparent;
}
.coach-actions button.ghost {
  background: transparent;
  color: var(--coach-exit);
  border-color: rgba(255,107,107,0.35);
}

.coach-section {
  border-top: 1px solid var(--coach-line);
  padding-top: 10px;
}
.coach-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--coach-dim);
  margin-bottom: 6px;
}
.coach-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 6px 0;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.coach-row:first-of-type { border-top: 0; }
.coach-hint {
  font-size: 11px;
  color: var(--coach-dim);
  line-height: 1.4;
}

.coach-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  touch-action: none;
}
.coach-resize::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255,255,255,0.25);
  border-bottom: 2px solid rgba(255,255,255,0.25);
}

@media (max-width: 720px) {
  #coach-fab { right: 12px; bottom: 12px; padding: 11px 14px; font-size: 12px; }
  #coach-window {
    left: 8px !important;
    right: 8px;
    top: auto !important;
    bottom: 64px;
    width: calc(100vw - 16px) !important;
    height: min(58vh, 480px) !important;
    max-height: calc(100vh - 80px);
  }
  .coach-titlebar .coach-status { max-width: 36%; }
}
